Module: GdsApi::TestHelpers::AssetManager

Defined in:
lib/gds_api/test_helpers/asset_manager.rb

Constant Summary collapse

ASSET_MANAGER_ENDPOINT =
Plek.current.find('asset-manager')

Instance Method Summary collapse

Instance Method Details

#asset_manager_does_not_have_an_asset(id) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/gds_api/test_helpers/asset_manager.rb', line 16

def asset_manager_does_not_have_an_asset(id)
  response = {
    "_response_info" => { "status" => "not found" }
  }

  stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/assets/#{id}")
    .to_return(:body => response.to_json, :status => 404)
end

#asset_manager_has_an_asset(id, atts) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/gds_api/test_helpers/asset_manager.rb', line 7

def asset_manager_has_an_asset(id, atts)
  response = atts.merge({
    "_response_info" => { "status" => "ok" }
  })

  stub_request(:get, "#{ASSET_MANAGER_ENDPOINT}/assets/#{id}")
    .to_return(:body => response.to_json, :status => 200)
end