diff --git a/spec/helpers/collection_resources_helper_spec.rb b/spec/helpers/collection_resources_helper_spec.rb index 7b3d190a1..4d39a0c2d 100644 --- a/spec/helpers/collection_resources_helper_spec.rb +++ b/spec/helpers/collection_resources_helper_spec.rb @@ -13,8 +13,7 @@ RSpec.describe CollectionResourcesHelper do describe "when displaying file metadata" do context "with pages" do before do - stub_request(:head, "https://core-test-collection-resources.s3.amazonaws.com/2023_24_lettings_paper_form.pdf") - .to_return(status: 200, body: "", headers: { "Content-Length" => 292_864, "Content-Type" => "application/pdf" }) + allow(storage_service).to receive(:get_file_metadata).with("2023_24_lettings_paper_form.pdf").and_return("content_length" => 292_864, "content_type" => "application/pdf") end it "returns correct metadata" do @@ -24,8 +23,7 @@ RSpec.describe CollectionResourcesHelper do context "without pages" do before do - stub_request(:head, "https://core-test-collection-resources.s3.amazonaws.com/bulk-upload-lettings-template-2023-24.xlsx") - .to_return(status: 200, body: "", headers: { "Content-Length" => 19_456, "Content-Type" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }) + allow(storage_service).to receive(:get_file_metadata).with("bulk-upload-lettings-template-2023-24.xlsx").and_return("content_length" => 19_456, "content_type" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") end it "returns correct metadata" do diff --git a/spec/request_helper.rb b/spec/request_helper.rb index e8a6726e9..f1f208ec6 100644 --- a/spec/request_helper.rb +++ b/spec/request_helper.rb @@ -103,9 +103,6 @@ module RequestHelper address = request.uri.query_values["query"].split(",") { status: 200, body: { results: [{ DPA: { MATCH: 0.9, BUILDING_NAME: "result #{address[0]}", POST_TOWN: "result town or city", POSTCODE: address[1], UPRN: "1" } }] }.to_json, headers: {} } end - - WebMock.stub_request(:head, /https:\/\/core-test-collection-resources\.s3\.amazonaws\.com/) - .to_return(status: 200, body: "", headers: { "Content-Type" => "application/pdf", "Content-Length" => 1000 }) end def self.real_http_requests