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 } %>
<% if FeatureToggle.new_locations_table_layout_enabled? %>
<% if FeatureToggle.location_toggle_enabled? %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<% 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? %>
</div>
</div>
<% end %>
<% if FeatureToggle.new_locations_table_layout_enabled? %>
<% if FeatureToggle.location_toggle_enabled? %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<%= 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 } %>
<% if FeatureToggle.new_locations_table_layout_enabled? %>
<% if FeatureToggle.location_toggle_enabled? %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<% end %>
@ -29,7 +29,7 @@
<% end %>
<% end %>
<% if FeatureToggle.new_locations_table_layout_enabled? %>
<% if FeatureToggle.location_toggle_enabled? %>
</div>
</div>
<% end %>

4
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

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
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

4
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)

Loading…
Cancel
Save