module Jets::SpecHelpers

def fixture_file(filename)

def fixture_file(filename)
  File.new(fixture_path(filename))
end

def fixture_path(filename)

def fixture_path(filename)
  "#{Jets.root}/spec/fixtures/#{filename}"
end

def http_call(method:, path:, **params)

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

def initialize(*)

def initialize(*)
  super
  @request = Request.new(:get, '/', {}, Params.new)
  @response = nil # will be set after http_call
end