From e8e0ef21a65850e7f8214593bf41a6c82227a1cd Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Thu, 17 Nov 2022 12:58:13 +0000 Subject: [PATCH] feat: use the existing location_toggle_enabled instead of new_locations_table_layout_enabled --- app/views/locations/index.html.erb | 6 +++--- app/views/schemes/show.html.erb | 4 ++-- config/initializers/feature_toggle.rb | 4 ---- spec/features/schemes_spec.rb | 2 +- spec/requests/locations_controller_spec.rb | 4 ++-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index b971cb9bd..b8882a40d 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -11,7 +11,7 @@ <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> -<% if FeatureToggle.new_locations_table_layout_enabled? %> +<% if FeatureToggle.location_toggle_enabled? %>
<% end %> @@ -22,12 +22,12 @@ <%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %> <%= govuk_section_break(visible: true, size: "m") %> -<% if FeatureToggle.new_locations_table_layout_enabled? %> +<% if FeatureToggle.location_toggle_enabled? %>
<% end %> -<% if FeatureToggle.new_locations_table_layout_enabled? %> +<% if FeatureToggle.location_toggle_enabled? %>
<%= govuk_table do |table| %> diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index 8de58c210..d6a8ce129 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -10,7 +10,7 @@ <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> -<% if FeatureToggle.new_locations_table_layout_enabled? %> +<% if FeatureToggle.location_toggle_enabled? %>
<% end %> @@ -29,7 +29,7 @@ <% end %> <% end %> -<% if FeatureToggle.new_locations_table_layout_enabled? %> +<% if FeatureToggle.location_toggle_enabled? %>
<% end %> diff --git a/config/initializers/feature_toggle.rb b/config/initializers/feature_toggle.rb index 08a8a4920..7cd75ddd3 100644 --- a/config/initializers/feature_toggle.rb +++ b/config/initializers/feature_toggle.rb @@ -22,8 +22,4 @@ class FeatureToggle def self.managing_for_other_user_enabled? !Rails.env.production? end - - def self.new_locations_table_layout_enabled? - !Rails.env.production? - end end diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 42a2b31ec..bee63350a 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -212,7 +212,7 @@ RSpec.describe "Schemes scheme Features" do context "when I click locations link and the new locations layout feature toggle is disabled" do before do - allow(FeatureToggle).to receive(:new_locations_table_layout_enabled?).and_return(false) + allow(FeatureToggle).to receive(:location_toggle_enabled?).and_return(false) click_link("Locations") end diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index 91f2e913c..45463ceb1 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -877,7 +877,7 @@ RSpec.describe LocationsController, type: :request do end it "shows locations with correct data wben the new locations layout feature toggle is disabled" do - allow(FeatureToggle).to receive(:new_locations_table_layout_enabled?).and_return(false) + allow(FeatureToggle).to receive(:location_toggle_enabled?).and_return(false) get "/schemes/#{scheme.id}/locations" locations.each do |location| expect(page).to have_content(location.id) @@ -993,7 +993,7 @@ RSpec.describe LocationsController, type: :request do end it "shows locations with correct data wben the new locations layout feature toggle is disabled" do - allow(FeatureToggle).to receive(:new_locations_table_layout_enabled?).and_return(false) + allow(FeatureToggle).to receive(:location_toggle_enabled?).and_return(false) get "/schemes/#{scheme.id}/locations" locations.each do |location| expect(page).to have_content(location.id)