From 61bf199934cf23d517f0094796edc64e92aa9b8d Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 13 Jun 2023 20:02:20 +0200 Subject: [PATCH] Update class in tests --- .../custom_wizard/subscription_spec.rb | 16 ++++++++-------- spec/fixtures/subscription_client.rb | 4 ++-- spec/plugin_helper.rb | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/components/custom_wizard/subscription_spec.rb b/spec/components/custom_wizard/subscription_spec.rb index 2db8dae0..8f254e0f 100644 --- a/spec/components/custom_wizard/subscription_spec.rb +++ b/spec/components/custom_wizard/subscription_spec.rb @@ -52,7 +52,7 @@ describe CustomWizard::Subscription do context "without a subscription" do before do - SubscriptionClient.stubs(:find_subscriptions).returns(nil) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(nil) end it "has none type" do @@ -70,7 +70,7 @@ describe CustomWizard::Subscription do context "with subscriptions" do def get_subscription_result(product_ids) - result = SubscriptionClient::Subscriptions::Result.new + result = DiscourseSubscriptionClient::Subscriptions::Result.new result.supplier = SubscriptionClientSupplier.new(product_slugs) result.resource = SubscriptionClientResource.new result.subscriptions = product_ids.map { |product_id| SubscriptionClientSubscription.new(product_id) } @@ -83,16 +83,16 @@ describe CustomWizard::Subscription do let!(:multiple_subscription_result) { get_subscription_result([community_product_id, business_product_id]) } it "handles mapped values" do - SubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result) expect(described_class.includes?(:wizard, :permitted, guests_permitted["permitted"])).to eq(true) - SubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result) expect(described_class.includes?(:wizard, :permitted, guests_permitted["permitted"])).to eq(false) end context "with a standard subscription" do before do - SubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result) end it "detects standard type" do @@ -110,7 +110,7 @@ describe CustomWizard::Subscription do context "with a business subscription" do before do - SubscriptionClient.stubs(:find_subscriptions).returns(business_subscription_result) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(business_subscription_result) end it "detects business type" do @@ -124,7 +124,7 @@ describe CustomWizard::Subscription do context "with a community subscription" do before do - SubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result) end it "detects community type" do @@ -138,7 +138,7 @@ describe CustomWizard::Subscription do context "with multiple subscriptions" do before do - SubscriptionClient.stubs(:find_subscriptions).returns(multiple_subscription_result) + DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(multiple_subscription_result) end it "detects correct type in hierarchy" do diff --git a/spec/fixtures/subscription_client.rb b/spec/fixtures/subscription_client.rb index 146279b1..acadbe8f 100644 --- a/spec/fixtures/subscription_client.rb +++ b/spec/fixtures/subscription_client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module SubscriptionClient +module DiscourseSubscriptionClient def self.find_subscriptions(resource_name) end end @@ -24,7 +24,7 @@ class SubscriptionClientSubscription end end -module SubscriptionClient +module DiscourseSubscriptionClient class Subscriptions class Result attr_accessor :supplier, diff --git a/spec/plugin_helper.rb b/spec/plugin_helper.rb index 8436f7c9..53b7173c 100644 --- a/spec/plugin_helper.rb +++ b/spec/plugin_helper.rb @@ -25,7 +25,7 @@ def disable_subscriptions end def undefine_client_classes - Object.send(:remove_const, :SubscriptionClient) if Object.constants.include?(:SubscriptionClient) + Object.send(:remove_const, :DiscourseSubscriptionClient) if Object.constants.include?(:DiscourseSubscriptionClient) Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription) end