Module: GdsApi::TestHelpers::ContentStore
Constant Summary
collapse
- CONTENT_STORE_ENDPOINT =
Plek.current.find('content-store')
Instance Method Summary
collapse
#content_item_for_base_path, #titleize_base_path
Instance Method Details
#content_store_does_not_have_item(base_path) ⇒ Object
18
19
20
21
|
# File 'lib/gds_api/test_helpers/content_store.rb', line 18
def content_store_does_not_have_item(base_path)
url = CONTENT_STORE_ENDPOINT + "/content" + base_path
stub_request(:get, url).to_return(status: 404, headers: {})
end
|
#content_store_has_item(base_path, body = content_item_for_base_path(base_path), expires_in = 900) ⇒ Object
12
13
14
15
16
|
# File 'lib/gds_api/test_helpers/content_store.rb', line 12
def content_store_has_item(base_path, body = content_item_for_base_path(base_path), expires_in = 900)
url = CONTENT_STORE_ENDPOINT + "/content" + base_path
body = body.to_json unless body.is_a?(String)
stub_request(:get, url).to_return(status: 200, body: body, headers: {cache_control: "public, max-age=#{expires_in}", date: Time.now.httpdate})
end
|
#content_store_isnt_available ⇒ Object
23
24
25
|
# File 'lib/gds_api/test_helpers/content_store.rb', line 23
def content_store_isnt_available
stub_request(:any, /#{CONTENT_STORE_ENDPOINT}\/.*/).to_return(:status => 503)
end
|