From 37b12cff9e880242bf4f5bb59efbaa97fb701698 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Wed, 16 Nov 2022 15:22:50 +0000 Subject: [PATCH] test: re-add tests for locations page when new layout not enabled --- spec/features/schemes_spec.rb | 10 ++++++++-- spec/requests/locations_controller_spec.rb | 20 ++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 336ee8338..5c668324e 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -204,8 +204,14 @@ RSpec.describe "Schemes scheme Features" do locations.each do |location| expect(page).to have_content(location.id) expect(page).to have_content(location.postcode) - expect(page).to have_content(location.name) - expect(page).to have_content("Active") + if FeatureToggle.new_locations_table_layout_enabled? + expect(page).to have_content(location.name) + expect(page).to have_content("Active") + else + expect(page).to have_content(location.units) + expect(page).to have_content(location.type_of_unit) + expect(page).to have_content(location.startdate&.to_formatted_s(:govuk_date)) + end end end end diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index 4eb510dcd..df9c497d0 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -871,8 +871,15 @@ RSpec.describe LocationsController, type: :request do locations.each do |location| expect(page).to have_content(location.id) expect(page).to have_content(location.postcode) - expect(page).to have_content(location.name) - expect(page).to have_content(location.status) + if FeatureToggle.new_locations_table_layout_enabled? + expect(page).to have_content(location.name) + expect(page).to have_content(location.status) + else + expect(page).to have_content(location.type_of_unit) + expect(page).to have_content(location.mobility_type) + expect(page).to have_content(location.location_admin_district) + expect(page).to have_content(location.startdate&.to_formatted_s(:govuk_date)) + end end end @@ -974,8 +981,13 @@ RSpec.describe LocationsController, type: :request do locations.each do |location| expect(page).to have_content(location.id) expect(page).to have_content(location.postcode) - expect(page).to have_content(location.name) - expect(page).to have_content(location.status) + if FeatureToggle.new_locations_table_layout_enabled? + expect(page).to have_content(location.name) + expect(page).to have_content(location.status) + else + expect(page).to have_content(location.type_of_unit) + expect(page).to have_content(location.startdate&.to_formatted_s(:govuk_date)) + end end end