1
0
Fork 0

Add support for server products PR in isolation

Dieser Commit ist enthalten in:
Angus McLeod 2023-05-04 15:49:04 +02:00
Ursprung 92fe9db1e0
Commit 3ea19e1086
3 geänderte Dateien mit 12 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -106,7 +106,7 @@ class CustomWizard::Subscription
def initialize
if CustomWizard::Subscription.client_installed?
result = DiscourseSubscriptionClient.find_subscriptions("discourse-custom-wizard")
result = SubscriptionClient.find_subscriptions("discourse-custom-wizard")
if result&.any?
slugs = result.supplier.product_slugs
@ -176,7 +176,7 @@ class CustomWizard::Subscription
end
def self.client_installed?
defined?(DiscourseSubscriptionClient) == 'constant' && DiscourseSubscriptionClient.class == Module
defined?(SubscriptionClient) == 'constant' && SubscriptionClient.class == Module
end
def self.subscribed?

Datei anzeigen

@ -14,7 +14,7 @@ describe CustomWizard::Subscription do
}
def undefine_client_classes
Object.send(:remove_const, :DiscourseSubscriptionClient) if Object.constants.include?(:DiscourseSubscriptionClient)
Object.send(:remove_const, :SubscriptionClient) if Object.constants.include?(:SubscriptionClient)
Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription)
end
@ -61,7 +61,7 @@ describe CustomWizard::Subscription do
context "without a subscription" do
before do
DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(nil)
SubscriptionClient.stubs(:find_subscriptions).returns(nil)
end
it "has none type" do
@ -79,7 +79,7 @@ describe CustomWizard::Subscription do
context "with subscriptions" do
def get_subscription_result(product_id)
result = DiscourseSubscriptionClient::Subscriptions::Result.new
result = SubscriptionClient::Subscriptions::Result.new
result.supplier = SubscriptionClientSupplier.new(product_slugs)
result.resource = SubscriptionClientResource.new
result.subscriptions = [SubscriptionClientSubscription.new(product_id)]
@ -90,16 +90,16 @@ describe CustomWizard::Subscription do
let!(:community_subscription_result) { get_subscription_result(community_product_id) }
it "handles mapped values" do
DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result)
SubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result)
expect(described_class.includes?(:wizard, :permitted, guests_permitted["permitted"])).to eq(true)
DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result)
SubscriptionClient.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
DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result)
SubscriptionClient.stubs(:find_subscriptions).returns(standard_subscription_result)
end
it "detects standard type" do
@ -117,7 +117,7 @@ describe CustomWizard::Subscription do
context "with a business subscription" do
before do
DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(business_subscription_result)
SubscriptionClient.stubs(:find_subscriptions).returns(business_subscription_result)
end
it "detects business type" do
@ -131,7 +131,7 @@ describe CustomWizard::Subscription do
context "with a community subscription" do
before do
DiscourseSubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result)
SubscriptionClient.stubs(:find_subscriptions).returns(community_subscription_result)
end
it "detects community type" do

Datei anzeigen

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