diff --git a/spec/features/schemes_helpers.rb b/spec/features/schemes_helpers.rb index 7bf087bab..3814a2f4c 100644 --- a/spec/features/schemes_helpers.rb +++ b/spec/features/schemes_helpers.rb @@ -55,7 +55,7 @@ module SchemesHelpers end def fill_in_and_save_location - fill_in "Postcode", with: "SW1P 4DF" + fill_in "Postcode", with: "AA1 1AA" fill_in "Location name (optional)", with: "Some name" fill_in "Total number of units at this location", with: 1 choose "Self-contained house" diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 14633ed74..0d6d9f27b 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -175,7 +175,7 @@ RSpec.describe "Schemes scheme Features" do context "when there are locations that belong to the selected scheme" do let!(:schemes) { FactoryBot.create_list(:scheme, 5) } let(:scheme) { schemes.first } - let!(:locations) { FactoryBot.create_list(:location, 3, scheme:) } + let!(:locations) { FactoryBot.create_list(:location, 3, scheme:, postcode: "AA11AA") } before do visit("schemes") @@ -199,6 +199,7 @@ RSpec.describe "Schemes scheme Features" do expect(page).to have_content(location.units) expect(page).to have_content(location.type_of_unit) expect(page).to have_content(location.mobility_type) + expect(page).to have_content(location.location_code) end end end @@ -383,11 +384,12 @@ RSpec.describe "Schemes scheme Features" do end it "displays information about the first created location" do - expect(page).to have_content "SW1P4DF" + expect(page).to have_content "AA11AA" expect(page).to have_content "Some name" expect(page).to have_content "Self-contained house" expect(page).to have_content "None" expect(page).to have_content "Local authority" + expect(page).to have_content "E09000033" end it "displays information about another location" do diff --git a/spec/request_helper.rb b/spec/request_helper.rb index d2bef6d5c..1e787b402 100644 --- a/spec/request_helper.rb +++ b/spec/request_helper.rb @@ -5,6 +5,11 @@ module RequestHelper WebMock.disable_net_connect!(allow_localhost: true) WebMock.stub_request(:get, /api.postcodes.io/) .to_return(status: 200, body: "{\"status\":404,\"error\":\"Postcode not found\"}", headers: {}) + + uri = "https://api.postcodes.io/postcodes/AA11AA" + WebMock.stub_request(:get, uri) + .to_return(status: 200, body: "{\"status\":200,\"result\":{\"postcode\":\"AA1 1AA\",\"quality\":1,\"eastings\":529922,\"northings\":179094,\"country\":\"England\",\"nhs_ha\":\"London\",\"longitude\":-0.12981,\"latitude\":51.495867,\"european_electoral_region\":\"London\",\"primary_care_trust\":\"Westminster\",\"region\":\"London\",\"lsoa\":\"Westminster 020C\",\"msoa\":\"Westminster 020\",\"incode\":\"4DF\",\"outcode\":\"SW1P\",\"parliamentary_constituency\":\"Cities of London and Westminster\",\"admin_district\":\"Westminster\",\"parish\":\"Westminster, unparished area\",\"admin_county\":null,\"admin_ward\":\"St James's\",\"ced\":null,\"ccg\":\"NHS North West London\",\"nuts\":\"Westminster\",\"codes\":{\"admin_district\":\"E09000033\",\"admin_county\":\"E99999999\",\"admin_ward\":\"E05000644\",\"parish\":\"E43000236\",\"parliamentary_constituency\":\"E14000639\",\"ccg\":\"E38000256\",\"ccg_id\":\"W2U3Z\",\"ced\":\"E99999999\",\"nuts\":\"TLI32\",\"lsoa\":\"E01004733\",\"msoa\":\"E02000979\",\"lau2\":\"E09000033\"}}}", headers: {}) + WebMock.stub_request(:post, /api.notifications.service.gov.uk\/v2\/notifications\/email/) .to_return(status: 200, body: "", headers: {}) WebMock.stub_request(:post, /api.notifications.service.gov.uk\/v2\/notifications\/sms/)