Sha256: dcfc201abd828d36a0d5f15877107518f6c5acac1f1ac94513019d1a5481c565

Contents?: true

Size: 609 Bytes

Versions: 30

Compression:

Stored size: 609 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))
      headers.each { |name, value| browser.header(name, value) }
      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

30 entries across 30 versions & 2 rubygems

Version Path
airborne-0.2.4 lib/airborne/rack_test_requester.rb
airborne-0.2.3 lib/airborne/rack_test_requester.rb
airborne-0.2.2 lib/airborne/rack_test_requester.rb
airborne-0.2.1 lib/airborne/rack_test_requester.rb
airborne-0.2.0 lib/airborne/rack_test_requester.rb
airborne-0.1.20 lib/airborne/rack_test_requester.rb
airborne-0.1.19 lib/airborne/rack_test_requester.rb
airborne-0.1.18 lib/airborne/rack_test_requester.rb
airborne-0.1.17 lib/airborne/rack_test_requester.rb
airborne-0.1.16 lib/airborne/rack_test_requester.rb