controller now only accepts string values for unread.

This commit is contained in:
Steven Fuchs 2011-12-23 15:35:07 -05:00
parent cd75c6ea67
commit a1d474111b
2 changed files with 1 additions and 5 deletions

View file

@ -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[:unread].to_s == "true" )
note.update_attributes(:unread => opts[:unread] == "true" )
{}
else
Response.new :status => 404

View file

@ -21,8 +21,6 @@ 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, :unread => false
Notification.first.unread.should == false
@controller.update :id => note.id, :unread => "false"
Notification.first.unread.should == false
end
@ -30,8 +28,6 @@ describe NotificationsController do
note = Factory(:notification, :recipient => @user)
@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
it 'only lets you read your own notifications' do