From f960b3fc83ecf60a0cd3ebd558964ac869e8a5e5 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Fri, 4 Apr 2025 13:34:32 +0200 Subject: [PATCH] Add tests --- test/controllers/bubbles/pops_controller_test.rb | 4 +++- test/models/pop_test.rb | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/controllers/bubbles/pops_controller_test.rb b/test/controllers/bubbles/pops_controller_test.rb index 2b480f23b..70cc2a34f 100644 --- a/test/controllers/bubbles/pops_controller_test.rb +++ b/test/controllers/bubbles/pops_controller_test.rb @@ -9,9 +9,11 @@ class Bubbles::PopsControllerTest < ActionDispatch::IntegrationTest bubble = bubbles(:logo) assert_changes -> { bubble.reload.popped? }, from: false, to: true do - post bucket_bubble_pop_url(bubble.bucket, bubble) + post bucket_bubble_pop_url(bubble.bucket, bubble, reason: "Scope too big") end + assert_equal "Scope too big", bubble.pop.reason + assert_redirected_to bucket_bubble_url(bubble.bucket, bubble) end diff --git a/test/models/pop_test.rb b/test/models/pop_test.rb index 608906ef2..c9b7a4cb9 100644 --- a/test/models/pop_test.rb +++ b/test/models/pop_test.rb @@ -1,7 +1,8 @@ require "test_helper" class PopTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end + test "default to the fallback reason if no reason is given" do + assert_equal "Not now", Pop.new(reason: "Not now").reason + assert_equal Account::PopReasons::FALLBACK_LABEL, Pop.new.reason + end end