Sha256: 51caa54d7299ef5bcfecef09f4fe9fc7b280c023d487639f23bdfc0e124c2c4b
Contents?: true
Size: 633 Bytes
Versions: 18
Compression:
Stored size: 633 Bytes
Contents
libdir = File.expand_path("lib") $:.unshift(libdir) unless $:.include?(libdir) module CallWithMockRequestMixin def call_with_mock_request(url = "/sample", method = "GET", params = Hash.new) params.merge!(:method => method) request = Rack::MockRequest.new(self) request.request(method, url, params) end end class MockApp attr_accessor :status, :headers, :body, :env def initialize(body) @status = 200 @headers = {"Content-Type" => "text/html"} @body = body end def call(env) @env = env @headers.merge("Content-Length" => @body.length.to_s) [@status, @headers, [@body]] end end
Version data entries
18 entries across 18 versions & 2 rubygems