1
0
Fork 0

Update class in tests

Dieser Commit ist enthalten in:
Angus McLeod 2023-06-13 20:02:20 +02:00
Ursprung 86e6945ad4
Commit 61bf199934
3 geänderte Dateien mit 11 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -52,7 +52,7 @@ describe CustomWizard::Subscription do
context "without a subscription" do context "without a subscription" do
before do before do
SubscriptionClient.stubs(:find_subscriptions).returns(nil) DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(nil)
end end
it "has none type" do it "has none type" do
@ -70,7 +70,7 @@ describe CustomWizard::Subscription do
context "with subscriptions" do context "with subscriptions" do
def get_subscription_result(product_ids) def get_subscription_result(product_ids)
result = SubscriptionClient::Subscriptions::Result.new result = DiscourseSubscriptionClient::Subscriptions::Result.new
result.supplier = SubscriptionClientSupplier.new(product_slugs) result.supplier = SubscriptionClientSupplier.new(product_slugs)
result.resource = SubscriptionClientResource.new result.resource = SubscriptionClientResource.new
result.subscriptions = product_ids.map { |product_id| SubscriptionClientSubscription.new(product_id) } 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]) } let!(:multiple_subscription_result) { get_subscription_result([community_product_id, business_product_id]) }
it "handles mapped values" do 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) 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) expect(described_class.includes?(:wizard, :permitted, guests_permitted["permitted"])).to eq(false)
end end
context "with a standard subscription" do context "with a standard subscription" do
before do before do
SubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result) DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result)
end end
it "detects standard type" do it "detects standard type" do
@ -110,7 +110,7 @@ describe CustomWizard::Subscription do
context "with a business subscription" do context "with a business subscription" do
before do before do
SubscriptionClient.stubs(:find_subscriptions).returns(business_subscription_result) DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(business_subscription_result)
end end
it "detects business type" do it "detects business type" do
@ -124,7 +124,7 @@ describe CustomWizard::Subscription do
context "with a community subscription" do context "with a community subscription" do
before do before do
SubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result) DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result)
end end
it "detects community type" do it "detects community type" do
@ -138,7 +138,7 @@ describe CustomWizard::Subscription do
context "with multiple subscriptions" do context "with multiple subscriptions" do
before do before do
SubscriptionClient.stubs(:find_subscriptions).returns(multiple_subscription_result) DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(multiple_subscription_result)
end end
it "detects correct type in hierarchy" do it "detects correct type in hierarchy" do

Datei anzeigen

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
module SubscriptionClient module DiscourseSubscriptionClient
def self.find_subscriptions(resource_name) def self.find_subscriptions(resource_name)
end end
end end
@ -24,7 +24,7 @@ class SubscriptionClientSubscription
end end
end end
module SubscriptionClient module DiscourseSubscriptionClient
class Subscriptions class Subscriptions
class Result class Result
attr_accessor :supplier, attr_accessor :supplier,

Datei anzeigen

@ -25,7 +25,7 @@ def disable_subscriptions
end end
def undefine_client_classes 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) Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription)
end end