mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Define feature toggles in FeatureToggle class rather than ENV['OFW_DEPLOYMENT']
This commit is contained in:
@@ -3,5 +3,5 @@ require "eaterprises_feature/engine"
|
||||
|
||||
module EaterprisesFeature
|
||||
extend Chili::Base
|
||||
active_if { ENV['OFW_DEPLOYMENT'] == 'eaterprises' }
|
||||
active_if { OpenFoodWeb::FeatureToggle.enabled? :eaterprises }
|
||||
end
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
require 'open_food_web/feature_toggle'
|
||||
|
||||
module EaterprisesFeature
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace EaterprisesFeature
|
||||
|
||||
if ENV['OFW_DEPLOYMENT'] == 'eaterprises'
|
||||
if OpenFoodWeb::FeatureToggle.enabled? :eaterprises
|
||||
initializer 'eaterprises_feature.sass', :after => :load_config_initializers do |app|
|
||||
app.config.sass.load_paths += [self.root.join('app', 'assets', 'stylesheets', 'eaterprises_feature')] if Rails.application.config.respond_to? :sass
|
||||
end
|
||||
|
||||
@@ -3,5 +3,5 @@ require "enterprises_distributor_info_rich_text_feature/engine"
|
||||
|
||||
module EnterprisesDistributorInfoRichTextFeature
|
||||
extend Chili::Base
|
||||
active_if { ENV['OFW_DEPLOYMENT'] == 'local_organics' }
|
||||
active_if { OpenFoodWeb::FeatureToggle.enabled? :enterprises_distributor_info_rich_text }
|
||||
end
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
require 'open_food_web/feature_toggle'
|
||||
|
||||
module EnterprisesDistributorInfoRichTextFeature
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace EnterprisesDistributorInfoRichTextFeature
|
||||
|
||||
initializer 'enterprises_distributor_info_rich_text_feature.mailer', :after => :load_config_initializers do |app|
|
||||
if ENV['OFW_DEPLOYMENT'] == 'local_organics'
|
||||
if OpenFoodWeb::FeatureToggle.enabled? :enterprises_distributor_info_rich_text
|
||||
::Spree::OrderMailer.class_eval do
|
||||
helper FeatureHelper
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@ require "local_organics_feature/engine"
|
||||
|
||||
module LocalOrganicsFeature
|
||||
extend Chili::Base
|
||||
active_if { ENV['OFW_DEPLOYMENT'] == 'local_organics' }
|
||||
active_if { OpenFoodWeb::FeatureToggle.enabled? :local_organics }
|
||||
end
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
require 'open_food_web/feature_toggle'
|
||||
|
||||
module LocalOrganicsFeature
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace LocalOrganicsFeature
|
||||
|
||||
if ENV['OFW_DEPLOYMENT'] == 'local_organics'
|
||||
if OpenFoodWeb::FeatureToggle.enabled? :local_organics
|
||||
initializer 'local_organics_feature.sass', :after => :load_config_initializers do |app|
|
||||
app.config.sass.load_paths += [self.root.join('app', 'assets', 'stylesheets', 'local_organics_feature')] if Rails.application.config.respond_to? :sass
|
||||
end
|
||||
|
||||
@@ -5,7 +5,10 @@ feature "enterprises distributor info as rich text" do
|
||||
include WebHelper
|
||||
|
||||
before(:each) do
|
||||
ENV['OFW_DEPLOYMENT'] = 'local_organics'
|
||||
OpenFoodWeb::FeatureToggle.stub(:features).and_return({eaterprises: false,
|
||||
local_organics: true,
|
||||
enterprises_distributor_info_rich_text: true})
|
||||
|
||||
|
||||
# The deployment is not set to local_organics on Rails init, so these
|
||||
# initializers won't run. Re-call them now that the deployment is set.
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
require 'simplecov'
|
||||
SimpleCov.start
|
||||
|
||||
# By default, test on eaterprises deployment settings
|
||||
# This must be set before rails loads so that it's available in engine initializers
|
||||
ENV['OFW_DEPLOYMENT'] ||= 'eaterprises'
|
||||
|
||||
require 'rubygems'
|
||||
|
||||
@@ -56,11 +53,6 @@ RSpec.configure do |config|
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
# By default, test on eaterprises deployment settings
|
||||
ENV['OFW_DEPLOYMENT'] ||= 'eaterprises'
|
||||
end
|
||||
|
||||
config.include Rails.application.routes.url_helpers
|
||||
config.include Spree::UrlHelpers
|
||||
config.include Spree::Core::TestingSupport::ControllerRequests, :type => :controller
|
||||
|
||||
Reference in New Issue
Block a user