From 0c458ef893afab4a9befa7b10ba6aab1beee5de2 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Thu, 3 Apr 2025 18:03:34 +0200 Subject: [PATCH] Add tests to make sure popping and engagement play well together --- test/models/bubble/engageable_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/models/bubble/engageable_test.rb b/test/models/bubble/engageable_test.rb index c0d7365d4..c34ad8aff 100644 --- a/test/models/bubble/engageable_test.rb +++ b/test/models/bubble/engageable_test.rb @@ -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)