Module: GdsApi::TestHelpers::NeedApi

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

Constant Summary collapse

NEED_API_ENDPOINT =

Generally true. If you are initializing the client differently, you could redefine/override the constant or stub directly.

Plek.current.find('needapi')

Instance Method Summary collapse

Instance Method Details

#need_api_has_organisations(organisation_ids) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/gds_api/test_helpers/need_api.rb', line 10

def need_api_has_organisations(organisation_ids)
  url = NEED_API_ENDPOINT + "/organisations"
  orgs = organisation_ids.map do |k,v|
    { "id" => k,
      "name" => v
    }
  end
  stub_request(:get, url).to_return(status: 200, body: orgs.to_json, headers: {})
end