Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-25 02:30:28 +01:00
35021eb176
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
|