Pre-calculate comment counts and activity scores
This commit is contained in:
@@ -10,4 +10,18 @@ class CommentTest < ActiveSupport::TestCase
|
||||
|
||||
assert_includes Comment.search("something rustic"), message.comment
|
||||
end
|
||||
|
||||
test "updating bubble counter" do
|
||||
assert_changes "bubbles(:logo).activity_score" do
|
||||
assert_difference "bubbles(:logo).comments_count", 1 do
|
||||
bubbles(:logo).capture Comment.new(body: "I'd prefer something more rustic")
|
||||
end
|
||||
end
|
||||
|
||||
assert_changes "bubbles(:logo).activity_score" do
|
||||
assert_difference "bubbles(:logo).comments_count", -1 do
|
||||
bubbles(:logo).messages.comments.last.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user