From c418312b6cf999e5aef2e6ac8e0ab20199d236f8 Mon Sep 17 00:00:00 2001 From: James Rose Date: Mon, 27 Feb 2023 12:24:38 +0000 Subject: [PATCH] Enable sales logs on production (#1352) --- config/initializers/feature_toggle.rb | 2 +- spec/features/sales_log_spec.rb | 4 ++-- spec/helpers/navigation_items_helper_spec.rb | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/initializers/feature_toggle.rb b/config/initializers/feature_toggle.rb index dda281e10..4fc402212 100644 --- a/config/initializers/feature_toggle.rb +++ b/config/initializers/feature_toggle.rb @@ -13,7 +13,7 @@ class FeatureToggle end def self.sales_log_enabled? - !Rails.env.production? + true end def self.managing_owning_enabled? diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index 270d9bf37..04331d824 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -53,9 +53,9 @@ RSpec.describe "Sales Log Features" do end end - context "when the sales log feature flag is toggled" do + context "when the sales log feature flag is disabled" do before do - allow(Rails.env).to receive(:production?).and_return(true) + allow(FeatureToggle).to receive(:sales_log_enabled?).and_return(false) end it "hides the create sales log button in production" do diff --git a/spec/helpers/navigation_items_helper_spec.rb b/spec/helpers/navigation_items_helper_spec.rb index 00e3cdccc..3656c49c5 100644 --- a/spec/helpers/navigation_items_helper_spec.rb +++ b/spec/helpers/navigation_items_helper_spec.rb @@ -7,9 +7,10 @@ RSpec.describe NavigationItemsHelper do let(:organisation_path) { "/organisations/#{current_user.organisation.id}" } describe "#primary items" do - context "when the sales log feature flag is enabled" do + context "when the sales log feature flag is disabled" do before do - allow(Rails.env).to receive(:production?).and_return(true) + allow(FeatureToggle).to receive(:sales_log_enabled?).and_return(false) + allow(FeatureToggle).to receive(:managing_owning_enabled?).and_return(false) end context "when the user is a data coordinator" do @@ -336,7 +337,12 @@ RSpec.describe NavigationItemsHelper do end end - context "when the sales log feature flag is disabled" do + context "when the sales log feature flag is enabled" do + before do + allow(FeatureToggle).to receive(:sales_log_enabled?).and_return(true) + allow(FeatureToggle).to receive(:managing_owning_enabled?).and_return(true) + end + context "when the user is a data coordinator" do context "when the user is on the lettings logs page" do let(:expected_navigation_items) do