Merge pull request #250 from paviliondev/add_product_slug_env_variable
Add product slug env variable
Dieser Commit ist enthalten in:
Commit
ebd25f2780
3 geänderte Dateien mit 28 neuen und 2 gelöschten Zeilen
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Laden …
In neuem Issue referenzieren