Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2025-02-08 22:17:02 +01:00
![Angus McLeod](/assets/img/avatar_default.png)
I've tweaked the subscription client gem so we can just use the gem's models and tables in this plugin's rspec, which makes duplicating and stubbing them unnecessary. See further https://github.com/paviliondev/discourse_subscription_client
25 Zeilen
654 B
Ruby
25 Zeilen
654 B
Ruby
# frozen_string_literal: true
|
|
|
|
def get_wizard_fixture(path)
|
|
JSON.parse(
|
|
File.open(
|
|
"#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/#{path}.json"
|
|
).read
|
|
).with_indifferent_access
|
|
end
|
|
|
|
def enable_subscription(type)
|
|
CustomWizard::Subscription.stubs("#{type}?".to_sym).returns(true)
|
|
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(true)
|
|
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
|