diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c868337ff..f6111fce5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -34,7 +34,7 @@ <% end %> - <% if Rails.env.production? %> + <% if Rails.env.production? && ENV["APP_HOST"].present? %> <% end %> diff --git a/app/views/lettings_logs/index.html.erb b/app/views/lettings_logs/index.html.erb index d1c7511f3..aeb03fe13 100644 --- a/app/views/lettings_logs/index.html.erb +++ b/app/views/lettings_logs/index.html.erb @@ -8,7 +8,9 @@
<%= govuk_button_to "Create a new lettings log", lettings_logs_path %> - <%= govuk_button_to "Create a new sales log", sales_logs_path %> + <% if FeatureToggle.sales_log_enabled? %> + <%= govuk_button_to "Create a new sales log", sales_logs_path %> + <% end %> <%#= govuk_link_to "Upload logs", bulk_upload_lettings_logs_path %>
diff --git a/config/initializers/feature_toggle.rb b/config/initializers/feature_toggle.rb index 50501fb65..7a06d5c9d 100644 --- a/config/initializers/feature_toggle.rb +++ b/config/initializers/feature_toggle.rb @@ -2,4 +2,10 @@ class FeatureToggle def self.startdate_two_week_validation_enabled? true end + + def self.sales_log_enabled? + return true unless Rails.env.production? + + false + end end diff --git a/spec/features/log_spec.rb b/spec/features/log_spec.rb index 2ae3d74d7..6939201e3 100644 --- a/spec/features/log_spec.rb +++ b/spec/features/log_spec.rb @@ -155,5 +155,15 @@ RSpec.describe "Log Features" do expect(page).to have_content("2022") end end + context "When the sales log feature flag is toggled" do + before do + allow(Rails.env).to receive(:production?).and_return(true) + end + + it "hides the create sales log button in production" do + visit("/logs") + expect(page).to_not have_content("Create a new sales log") + end + end end end