1
0
Fork 0

Add product slug env variable

Dieser Commit ist enthalten in:
Angus McLeod 2023-06-29 10:26:39 +02:00
Ursprung cd6503d425
Commit af39c567ea
3 geänderte Dateien mit 28 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -124,6 +124,8 @@ class CustomWizard::Subscription
@product_slug = id_and_slug[:slug] @product_slug = id_and_slug[:slug]
end end
end end
@product_slug ||= ENV["CUSTOM_WIZARD_PRODUCT_SLUG"]
end end
def includes?(feature, attribute, value = nil) def includes?(feature, attribute, value = nil)
@ -153,8 +155,8 @@ class CustomWizard::Subscription
def type def type
return :none unless subscribed? return :none unless subscribed?
return :standard if standard?
return :business if business? return :business if business?
return :standard if standard?
return :community if community? return :community if community?
end end

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# name: discourse-custom-wizard # name: discourse-custom-wizard
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
# version: 2.4.8 # version: 2.4.9
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
# url: https://github.com/paviliondev/discourse-custom-wizard # url: https://github.com/paviliondev/discourse-custom-wizard
# contact_emails: development@pavilion.tech # contact_emails: development@pavilion.tech

Datei anzeigen

@ -147,4 +147,28 @@ describe CustomWizard::Subscription do
end end
end end
end end
context "with environment variable" do
before do
ENV["CUSTOM_WIZARD_PRODUCT_SLUG"] = "standard"
end
after do
ENV["CUSTOM_WIZARD_PRODUCT_SLUG"] = nil
end
it "enables the relevant subscription" do
expect(described_class.type).to eq(:standard)
end
context "with a subscription" do
before do
enable_subscription("business")
end
it "respects the subscription" do
expect(described_class.type).to eq(:business)
end
end
end
end end