Module: RSpecAPITest::HTTPHelpers

Defined in:
lib/rspec_api_test/http_helpers.rb

Defined Under Namespace

Classes: JSONArrayResponse, JSONHashResponse

Instance Method Summary collapse

Instance Method Details

#request(*args) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/rspec_api_test/http_helpers.rb', line 32

def request(*args)
  defaults = RSpecAPITest.config[:defaults] || {}
  opts_i = args[2].is_a?(String) ? 3 : 2
  args[opts_i] ||= {} if defaults
  args[opts_i].reverse_merge!(defaults) 
  RestClient.send(*args)
rescue RestClient::Exception => e
  e.response
end