Browse Source

feat: use the existing location_toggle_enabled instead of new_locations_table_layout_enabled

pull/987/head
Sam Seed 4 years ago
parent
commit
e8e0ef21a6
  1. 6
      app/views/locations/index.html.erb
  2. 4
      app/views/schemes/show.html.erb
  3. 4
      config/initializers/feature_toggle.rb
  4. 2
      spec/features/schemes_spec.rb
  5. 4
      spec/requests/locations_controller_spec.rb

6
app/views/locations/index.html.erb

@ -11,7 +11,7 @@
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
<% if FeatureToggle.new_locations_table_layout_enabled? %> <% if FeatureToggle.location_toggle_enabled? %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<% end %> <% end %>
@ -22,12 +22,12 @@
<%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %> <%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %>
<%= govuk_section_break(visible: true, size: "m") %> <%= govuk_section_break(visible: true, size: "m") %>
<% if FeatureToggle.new_locations_table_layout_enabled? %> <% if FeatureToggle.location_toggle_enabled? %>
</div> </div>
</div> </div>
<% end %> <% end %>
<% if FeatureToggle.new_locations_table_layout_enabled? %> <% if FeatureToggle.location_toggle_enabled? %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<%= govuk_table do |table| %> <%= govuk_table do |table| %>

4
app/views/schemes/show.html.erb

@ -10,7 +10,7 @@
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
<% if FeatureToggle.new_locations_table_layout_enabled? %> <% if FeatureToggle.location_toggle_enabled? %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<% end %> <% end %>
@ -29,7 +29,7 @@
<% end %> <% end %>
<% end %> <% end %>
<% if FeatureToggle.new_locations_table_layout_enabled? %> <% if FeatureToggle.location_toggle_enabled? %>
</div> </div>
</div> </div>
<% end %> <% end %>

4
config/initializers/feature_toggle.rb

@ -22,8 +22,4 @@ class FeatureToggle
def self.managing_for_other_user_enabled? def self.managing_for_other_user_enabled?
!Rails.env.production? !Rails.env.production?
end end
def self.new_locations_table_layout_enabled?
!Rails.env.production?
end
end end

2
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 context "when I click locations link and the new locations layout feature toggle is disabled" do
before 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") click_link("Locations")
end end

4
spec/requests/locations_controller_spec.rb

@ -877,7 +877,7 @@ RSpec.describe LocationsController, type: :request do
end end
it "shows locations with correct data wben the new locations layout feature toggle is disabled" do 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" get "/schemes/#{scheme.id}/locations"
locations.each do |location| locations.each do |location|
expect(page).to have_content(location.id) expect(page).to have_content(location.id)
@ -993,7 +993,7 @@ RSpec.describe LocationsController, type: :request do
end end
it "shows locations with correct data wben the new locations layout feature toggle is disabled" do 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" get "/schemes/#{scheme.id}/locations"
locations.each do |location| locations.each do |location|
expect(page).to have_content(location.id) expect(page).to have_content(location.id)

Loading…
Cancel
Save