Module: GdsApi::TestHelpers::ContentStore

Includes:
CommonResponses
Defined in:
lib/gds_api/test_helpers/content_store.rb

Constant Summary collapse

CONTENT_STORE_ENDPOINT =
Plek.current.find('content-store')

Instance Method Summary collapse

Methods included from CommonResponses

#acronymize_slug, #plural_response_base, #response_base, #titleize_slug

Instance Method Details

#content_store_has_item(base_path, body = item_for_base_path(base_path)) ⇒ Object



11
12
13
14
# File 'lib/gds_api/test_helpers/content_store.rb', line 11

def content_store_has_item(base_path, body = item_for_base_path(base_path))
  url = CONTENT_STORE_ENDPOINT + "/content" + base_path
  stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
end

#item_for_base_path(base_path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gds_api/test_helpers/content_store.rb', line 16

def item_for_base_path(base_path)
  {
    "title" => titleize_slug(base_path),
    "description" => "Description for #{base_path}",
    "format" => "guide",
    "need_ids" => ["100001"],
    "public_updated_at" => "2014-05-06T12:01:00+00:00",
    "base_path" => base_path,
    "details" => {
      "body" => "Some content for #{base_path}",
    }
  }
end