Add tests to make sure popping and engagement play well together

This commit is contained in:
Jorge Manrubia
2025-04-03 18:03:34 +02:00
parent 7cb2a476c4
commit 0c458ef893
+22
View File
@@ -1,6 +1,10 @@
require "test_helper"
class Bubble::EngageableTest < ActiveSupport::TestCase
setup do
Current.session = sessions(:david)
end
test "check the engagement status of a bubble" do
assert bubbles(:logo).doing?
assert_not bubbles(:text).doing?
@@ -19,6 +23,24 @@ class Bubble::EngageableTest < ActiveSupport::TestCase
end
end
test "engaging with popped bubbles" do
bubbles(:text).pop!
assert_not bubbles(:text).considering?
assert_not bubbles(:text).doing?
bubbles(:text).engage
assert_not bubbles(:text).reload.popped?
assert bubbles(:text).doing?
bubbles(:text).pop!
bubbles(:text).reconsider
assert_not bubbles(:text).reload.popped?
assert bubbles(:text).considering?
end
test "scopes" do
assert_includes Bubble.doing, bubbles(:logo)
assert_not_includes Bubble.doing, bubbles(:text)