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.3.7 lib/airborne/rack_test_requester.rb
airborne-0.3.6 lib/airborne/rack_test_requester.rb
airborne-0.3.5 lib/airborne/rack_test_requester.rb
hops-airborne-0.2.17 lib/airborne/rack_test_requester.rb
airborne-0.3.4 lib/airborne/rack_test_requester.rb
airborne-0.3.3 lib/airborne/rack_test_requester.rb
airborne-0.3.2 lib/airborne/rack_test_requester.rb
airborne-0.3.1 lib/airborne/rack_test_requester.rb
airborne-0.3.0 lib/airborne/rack_test_requester.rb
hops-airborne-0.2.16 lib/airborne/rack_test_requester.rb
hops-airborne-0.2.15 lib/airborne/rack_test_requester.rb
airborne-0.2.13 lib/airborne/rack_test_requester.rb
airborne-0.2.12 lib/airborne/rack_test_requester.rb
airborne-0.2.11 lib/airborne/rack_test_requester.rb
airborne-0.2.10 lib/airborne/rack_test_requester.rb
airborne-0.2.9 lib/airborne/rack_test_requester.rb
airborne-0.2.8 lib/airborne/rack_test_requester.rb
airborne-0.2.7 lib/airborne/rack_test_requester.rb
airborne-0.2.6 lib/airborne/rack_test_requester.rb
airborne-0.2.5 lib/airborne/rack_test_requester.rb