Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 17:30:29 +01:00
Also ensure subscription client definition is in the right state
Dieser Commit ist enthalten in:
Ursprung
99e747a331
Commit
c256a41668
3 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen
|
@ -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
|
after do
|
||||||
undefine_client_classes
|
undefine_client_classes
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,3 +23,12 @@ def disable_subscriptions
|
||||||
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(false)
|
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(false)
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
|
@ -16,20 +16,21 @@ describe CustomWizard::AdminController do
|
||||||
context "without a subscription" do
|
context "without a subscription" do
|
||||||
before do
|
before do
|
||||||
disable_subscriptions
|
disable_subscriptions
|
||||||
|
define_client_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the right subscription details" do
|
it "returns the right subscription details" do
|
||||||
get "/admin/wizards.json"
|
get "/admin/wizards.json"
|
||||||
expect(response.parsed_body["subscribed"]).to eq(false)
|
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_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
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a subscription" do
|
context "with a subscription" do
|
||||||
before do
|
before do
|
||||||
enable_subscription("standard")
|
enable_subscription("standard")
|
||||||
load File.expand_path("#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/subscription_client.rb", __FILE__)
|
define_client_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the right subscription details" do
|
it "returns the right subscription details" do
|
||||||
|
|
Laden …
In neuem Issue referenzieren