Skip to content

Commit d2f2a81

Browse files
committed
added tests covering CommentThread#remove_follower last activity bumping
1 parent b6d0a52 commit d2f2a81

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

test/models/comment_thread_test.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,28 @@ class CommentThreadTest < ActiveSupport::TestCase
1616
end
1717
end
1818

19-
test 'last_activity should correctly get the thread\'s last activity date & time' do
19+
test 'remove_follower should correctly bump last_activity' do
20+
std_usr = users(:standard_user)
2021
thread = comment_threads(:without_activity)
22+
assert_equal thread.created_at, thread.last_activity
23+
24+
thread.add_follower(std_usr)
25+
thread.reload
26+
last_activity_after_follow = thread.last_activity
27+
28+
thread.remove_follower(std_usr)
29+
thread.reload
30+
last_activity_after_unfollow = thread.last_activity
31+
assert_operator last_activity_after_follow, '<', last_activity_after_unfollow
32+
33+
thread.remove_follower(std_usr)
34+
thread.reload
35+
last_activity_after_noop = thread.last_activity
36+
assert_operator last_activity_after_unfollow, '<', last_activity_after_noop
37+
end
2138

39+
test 'last_activity should correctly get the thread\'s last activity date & time' do
40+
thread = comment_threads(:without_activity)
2241
assert_equal thread.created_at, thread.last_activity
2342

2443
thread.update!(title: 'this should bump last_activity')

0 commit comments

Comments
 (0)