From b81da8a88aed2bb003df09d61af2d4660de12bee Mon Sep 17 00:00:00 2001 From: CEdwardsBlasikiewicz Date: Thu, 12 Dec 2024 10:03:39 +1100 Subject: [PATCH] test mock url --- spec/files/global_messages/global_message.json | 6 ++++++ spec/support/webmock.rb | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 spec/files/global_messages/global_message.json diff --git a/spec/files/global_messages/global_message.json b/spec/files/global_messages/global_message.json new file mode 100644 index 00000000..1d55a3ff --- /dev/null +++ b/spec/files/global_messages/global_message.json @@ -0,0 +1,6 @@ +[ + { + "Title": "\u003Ca href=\"/node/1607\" hreflang=\"en\"\u003ECatalogue Message\u003C/a\u003E", + "body": "\u003Cp\u003EThe Library's summer opening hours are in place from Monday 23 December 2024 until Wednesday 1 January 2025 (inclusive). Before planning your visit, check our \u003Ca href=\"https://www.library.gov.au/visit/opening-hours\"\u003Eopening hours\u003C/a\u003E and \u003Ca href=\"https://www.library.gov.au/research/access-collection/temporary-changes-collection-access\"\u003Etemporary changes to collection access\u003C/a\u003E.\u003C/p\u003E" + } +] \ No newline at end of file diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb index 4d55c829..6acdf957 100644 --- a/spec/support/webmock.rb +++ b/spec/support/webmock.rb @@ -279,5 +279,16 @@ } ) .to_return(status: 200, body: email_2fa, headers: {}) + + global_message = IO.read("spec/files/global_message.json") + + WebMock.stub_request(:get, "https://www.library.gov.au/catalogue-message") + .with( + headers: { + "Accept" => "application/json", + "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" + } + ) + .to_return(status: 200, body: global_message, headers: {}) end end