Method: Jets::SpecHelpers#http_call

Defined in:
lib/jets/spec_helpers.rb

#http_call(method:, path:, **params) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/jets/spec_helpers.rb', line 25

def http_call(method:, path:, **params)
  request.method = method.to_sym
  request.path = path
  request.headers.deep_merge!(params.delete(:headers) || {})

  request.params.body_params = params.delete(:params) || params || {}

  request.params.query_params = params.delete(:query)
  request.params.query_params ||= params if request.method == :get
  request.params.query_params ||= {}

  request.params.path_params = params

  @response = request.dispatch!
end