diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 22ac5fa5fb54c6bb7561577619086d16128323b4..07853afed210205fcec272f140a1c1084cd9a2c9 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -11,7 +11,7 @@ class NotificationsController < VannaController def update(opts=params) note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first if note - note.update_attributes(:unread => opts[:is_unread] || false ) + note.update_attributes(:unread => opts[:unread] || false ) {} else Response.new :status => 404 diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index baf59f870c2a7172a1708caacf99f76123ff474e..389cdca2621b3ab0d16ebb06189e19b6fad7444c 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -21,12 +21,16 @@ describe NotificationsController do end it 'marks a notification as read if it is told to' do 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 end it 'marks a notification as unread if it is told to' do 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 end