1
0
Fork 0

Also ensure subscription client definition is in the right state

Dieser Commit ist enthalten in:
Angus McLeod 2023-05-31 14:27:00 +02:00
Ursprung 99e747a331
Commit c256a41668
3 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -13,15 +13,6 @@ describe CustomWizard::Subscription do
}
}
def undefine_client_classes
Object.send(:remove_const, :SubscriptionClient) if Object.constants.include?(:SubscriptionClient)
Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription)
end
def define_client_classes
load File.expand_path("#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/subscription_client.rb", __FILE__)
end
after do
undefine_client_classes
end

Datei anzeigen

@ -23,3 +23,12 @@ def disable_subscriptions
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(false)
end
end
def undefine_client_classes
Object.send(:remove_const, :SubscriptionClient) if Object.constants.include?(:SubscriptionClient)
Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription)
end
def define_client_classes
load File.expand_path("#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/subscription_client.rb", __FILE__)
end

Datei anzeigen

@ -16,20 +16,21 @@ describe CustomWizard::AdminController do
context "without a subscription" do
before do
disable_subscriptions
define_client_classes
end
it "returns the right subscription details" do
get "/admin/wizards.json"
expect(response.parsed_body["subscribed"]).to eq(false)
expect(response.parsed_body["subscription_attributes"]).to eq(CustomWizard::Subscription.attributes.as_json)
expect(response.parsed_body["subscription_client_installed"]).to eq(false)
expect(response.parsed_body["subscription_client_installed"]).to eq(true)
end
end
context "with a subscription" do
before do
enable_subscription("standard")
load File.expand_path("#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/subscription_client.rb", __FILE__)
define_client_classes
end
it "returns the right subscription details" do