changes is_unread parameter to unread
This commit is contained in:
parent
4d6f53401b
commit
f3486e831f
2 changed files with 7 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ class NotificationsController < VannaController
|
||||||
def update(opts=params)
|
def update(opts=params)
|
||||||
note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first
|
note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first
|
||||||
if note
|
if note
|
||||||
note.update_attributes(:unread => opts[:is_unread] || false )
|
note.update_attributes(:unread => opts[:unread] || false )
|
||||||
{}
|
{}
|
||||||
else
|
else
|
||||||
Response.new :status => 404
|
Response.new :status => 404
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,16 @@ describe NotificationsController do
|
||||||
end
|
end
|
||||||
it 'marks a notification as read if it is told to' do
|
it 'marks a notification as read if it is told to' do
|
||||||
note = Factory(:notification, :recipient => @user)
|
note = Factory(:notification, :recipient => @user)
|
||||||
@controller.update :id => note.id, :is_unread => false
|
@controller.update :id => note.id, :unread => false
|
||||||
|
Notification.first.unread.should == false
|
||||||
|
@controller.update :id => note.id, :unread => "false"
|
||||||
Notification.first.unread.should == false
|
Notification.first.unread.should == false
|
||||||
end
|
end
|
||||||
it 'marks a notification as unread if it is told to' do
|
it 'marks a notification as unread if it is told to' do
|
||||||
note = Factory(:notification, :recipient => @user)
|
note = Factory(:notification, :recipient => @user)
|
||||||
@controller.update :id => note.id, :is_unread => true
|
@controller.update :id => note.id, :unread => "true"
|
||||||
|
Notification.first.unread.should == true
|
||||||
|
@controller.update :id => note.id, :unread => true
|
||||||
Notification.first.unread.should == true
|
Notification.first.unread.should == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue