Module: GdsApi::TestHelpers::BusinessSupportApi

Includes:
BusinessSupportHelper, CommonResponses
Defined in:
lib/gds_api/test_helpers/business_support_api.rb

Constant Summary collapse

BUSINESS_SUPPORT_API_ENDPOINT =

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

Plek.current.find('business-support-api')

Instance Method Summary collapse

Methods included from BusinessSupportHelper

#api_has_business_support, #setup_business_support_stubs

Methods included from CommonResponses

#acronymize_slug, #plural_response_base, #response_base, #titleize_slug

Instance Method Details

#business_support_api_has_a_scheme(slug, scheme) ⇒ Object



26
27
28
29
30
31
# File 'lib/gds_api/test_helpers/business_support_api.rb', line 26

def business_support_api_has_a_scheme(slug, scheme)
  title = scheme.delete(:title)
  stub_request(:get, %r{\A#{BUSINESS_SUPPORT_API_ENDPOINT}/business-support-schemes/#{slug}\.json}).to_return do |request|
    {:body => response_base.merge(:format => 'business_support', :title => title, :details => scheme).to_json}
  end
end

#business_support_api_has_scheme(scheme, facets = {}) ⇒ Object



16
17
18
# File 'lib/gds_api/test_helpers/business_support_api.rb', line 16

def business_support_api_has_scheme(scheme, facets={})
  api_has_business_support(scheme, facets)
end

#business_support_api_has_schemes(schemes, facets = {}) ⇒ Object



20
21
22
23
24
# File 'lib/gds_api/test_helpers/business_support_api.rb', line 20

def business_support_api_has_schemes(schemes, facets={})
  schemes.each do |scheme|
    business_support_api_has_scheme(scheme, facets)
  end
end

#setup_business_support_api_schemes_stubsObject



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

def setup_business_support_api_schemes_stubs
  setup_business_support_stubs(BUSINESS_SUPPORT_API_ENDPOINT, 'business-support-schemes')
end