From ebc212c1d7991ae534f87e041a92a8af79e6f2b5 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Mon, 24 Nov 2025 16:26:41 +0100 Subject: [PATCH] Fix: the queenbe mocks were not really being applied --- saas/lib/fizzy/saas/engine.rb | 7 +++++++ saas/{test/test_helper.rb => lib/fizzy/saas/testing.rb} | 0 .../controllers/signups/completions_controller_test.rb | 2 -- saas/test/models/signup_test.rb | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) rename saas/{test/test_helper.rb => lib/fizzy/saas/testing.rb} (100%) diff --git a/saas/lib/fizzy/saas/engine.rb b/saas/lib/fizzy/saas/engine.rb index c804c38d1..653d20fdb 100644 --- a/saas/lib/fizzy/saas/engine.rb +++ b/saas/lib/fizzy/saas/engine.rb @@ -17,6 +17,13 @@ module Fizzy app.config.middleware.insert_after(ActiveRecord::Middleware::DatabaseSelector, TransactionPinning::Middleware) end + # Load test mocks automatically in test environment + initializer "fizzy_saas.test_mocks", after: :load_config_initializers do + if Rails.env.test? + require "fizzy/saas/testing" + end + end + config.to_prepare do Queenbee::Subscription.short_names = Subscription::SHORT_NAMES Queenbee::ApiToken.token = Rails.application.credentials.dig(:queenbee_api_token) diff --git a/saas/test/test_helper.rb b/saas/lib/fizzy/saas/testing.rb similarity index 100% rename from saas/test/test_helper.rb rename to saas/lib/fizzy/saas/testing.rb diff --git a/saas/test/controllers/signups/completions_controller_test.rb b/saas/test/controllers/signups/completions_controller_test.rb index 955300f55..49628a188 100644 --- a/saas/test/controllers/signups/completions_controller_test.rb +++ b/saas/test/controllers/signups/completions_controller_test.rb @@ -18,8 +18,6 @@ class Signup::CompletionsControllerTest < ActionDispatch::IntegrationTest end test "create" do - Queenbee::Remote::Account.any_instance.stubs(:save).returns(true) - untenanted do post saas.signup_completion_path, params: { signup: { diff --git a/saas/test/models/signup_test.rb b/saas/test/models/signup_test.rb index d34518322..0751f4c91 100644 --- a/saas/test/models/signup_test.rb +++ b/saas/test/models/signup_test.rb @@ -30,7 +30,6 @@ class SignupTest < ActiveSupport::TestCase test "#complete" do ::Account.any_instance.expects(:setup_customer_template).once - Queenbee::Remote::Account.any_instance.stubs(:save).returns(true) ::Current.without_account do signup = Signup.new(