2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00

disable observers in tests, enable as needed, tests are 20% faster

This commit is contained in:
Sam 2013-05-14 11:59:55 +10:00
parent fff46cf5aa
commit ef98b60184
11 changed files with 95 additions and 60 deletions

View file

@ -13,12 +13,15 @@ describe PostTiming do
# integration test
it 'processes timings correctly' do
ActiveRecord::Base.observers.enable :all
post = Fabricate(:post)
user2 = Fabricate(:coding_horror)
PostAction.act(user2, post, PostActionType.types[:like])
post.user.unread_notifications.should == 1
post.user.unread_notifications.should == 1
post.user.unread_notifications_by_type.should == { Notification.types[:liked] => 1 }
PostTiming.process_timings(post.user, post.topic_id, 1, [[post.post_number, 100]])