Module: GdsApi::TestHelpers::Support

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

Constant Summary collapse

SUPPORT_ENDPOINT =
Plek.current.find("support")

Instance Method Summary collapse

Instance Method Details

#stub_support_foi_request_creation(request_details = nil) ⇒ Object



6
7
8
9
10
# File 'lib/gds_api/test_helpers/support.rb', line 6

def stub_support_foi_request_creation(request_details = nil)
  post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/foi_requests")
  post_stub.with(body: { "foi_request" => request_details }) unless request_details.nil?
  post_stub.to_return(status: 201)
end

#stub_support_isnt_availableObject



18
19
20
# File 'lib/gds_api/test_helpers/support.rb', line 18

def stub_support_isnt_available
  stub_request(:post, /#{SUPPORT_ENDPOINT}\/.*/).to_return(status: 503)
end

#stub_support_named_contact_creation(request_details = nil) ⇒ Object



12
13
14
15
16
# File 'lib/gds_api/test_helpers/support.rb', line 12

def stub_support_named_contact_creation(request_details = nil)
  post_stub = stub_http_request(:post, "#{SUPPORT_ENDPOINT}/named_contacts")
  post_stub.with(body: { named_contact: request_details }) unless request_details.nil?
  post_stub.to_return(status: 201)
end