Skip to content
Extraits de code Groupes Projets
Valider f72a4b44 rédigé par Steven Fuchs's avatar Steven Fuchs
Parcourir les fichiers

notifications controller should return the guid and unread state of the updated notification

parent a1d47411
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -12,7 +12,7 @@ class NotificationsController < VannaController
note = Notification.where(:recipient_id => current_user.id, :id => opts[:id]).first
if note
note.update_attributes(:unread => opts[:unread] == "true" )
{}
{ :guid => note.id, :unread => note.unread }
else
Response.new :status => 404
end
......
......@@ -30,6 +30,17 @@ describe NotificationsController do
Notification.first.unread.should == true
end
it 'should return the item guid' do
note = Factory(:notification, :recipient => @user)
answer = @controller.update :id => note.id
answer[:guid].should == note.id
end
it 'should return the unread state' do
note = Factory(:notification, :recipient => @user)
answer = @controller.update :id => note.id, :unread => "true"
answer[:unread].should == true
end
it 'only lets you read your own notifications' do
user2 = bob
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter