Sha256: 7ab1ac780ace152fe61753a0f9ebe579b5916b24facb8fb7b6325a58a93d1ef4
Contents?: true
Size: 885 Bytes
Versions: 9
Compression:
Stored size: 885 Bytes
Contents
ENV['RACK_ENV'] = 'test' begin require 'rack' rescue LoadError require 'rubygems' require 'rack' end testdir = File.dirname(__FILE__) $LOAD_PATH.unshift(testdir) unless $LOAD_PATH.include?(testdir) libdir = File.dirname(File.dirname(__FILE__)) + '/lib' $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) require 'test/unit' require 'rack/accept' class Test::Unit::TestCase attr_reader :context attr_reader :response def status @response && @response.status end def request(env={}, method='GET', uri='/') @context = Rack::Accept.new(fake_app) yield @context if block_given? mock_request = Rack::MockRequest.new(@context) @response = mock_request.request(method.to_s.upcase, uri, env) @response end def fake_app(status=200, headers={}, body=[]) lambda {|env| Rack::Response.new(body, status, headers).finish } end end
Version data entries
9 entries across 9 versions & 3 rubygems