fixed a pile of notification craziness

addes some tests around post timings
This commit is contained in:
Sam Saffron
2013-02-25 18:42:42 +11:00
parent cb3d839104
commit 77a2d8ccc4
7 changed files with 116 additions and 49 deletions

View File

@@ -108,4 +108,17 @@ describe Notification do
end
end
describe 'mark_posts_read' do
it "marks multiple posts as read if needed" do
user = Fabricate(:user)
notifications = (1..3).map do |i|
Notification.create!(read: false, user_id: user.id, topic_id: 2, post_number: i, data: '[]', notification_type: 1)
end
Notification.create!(read: true, user_id: user.id, topic_id: 2, post_number: 4, data: '[]', notification_type: 1)
Notification.mark_posts_read(user,2,[1,2,3,4]).should == 3
end
end
end