Sha256: e485c9b7ef849acdec163af2cc3e5fd66fbc3b542395cb6466829f0c61bf1c1c

Contents?: true

Size: 544 Bytes

Versions: 5

Compression:

Stored size: 544 Bytes

Contents

require 'rack/test'

module Airborne
  module RackTestRequester
    def make_request(method, url, options = {})
      headers = options[:headers] || {}
      base_headers = Airborne.configuration.headers || {}
      headers = base_headers.merge(headers)
      browser = Rack::Test::Session.new(Rack::MockSession.new(Airborne.configuration.rack_app))
      browser.send(method, url, options[:body] || {}, headers)
      Rack::MockResponse.class_eval do
        alias_method :code, :status
      end
      browser.last_response
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
airborne-0.1.15 lib/airborne/rack_test_requester.rb
airborne-0.1.14 lib/airborne/rack_test_requester.rb
airborne-0.1.13 lib/airborne/rack_test_requester.rb
airborne-0.1.12 lib/airborne/rack_test_requester.rb
airborne-0.1.11 lib/airborne/rack_test_requester.rb