0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 17:30:29 +01:00

Ensure subscriptions are not stubbed if testing for no subscription

Dieser Commit ist enthalten in:
Angus McLeod 2023-05-31 12:09:00 +02:00
Ursprung 4bfea70dde
Commit 99e747a331
2 geänderte Dateien mit 15 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -12,3 +12,14 @@ def enable_subscription(type)
CustomWizard::Subscription.stubs("#{type}?".to_sym).returns(true) CustomWizard::Subscription.stubs("#{type}?".to_sym).returns(true)
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(true) CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(true)
end end
def disable_subscriptions
%w[
standard
business
community
].each do |type|
CustomWizard::Subscription.stubs("#{type}?".to_sym).returns(false)
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(false)
end
end

Datei anzeigen

@ -14,6 +14,10 @@ describe CustomWizard::AdminController do
end end
context "without a subscription" do context "without a subscription" do
before do
disable_subscriptions
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)