Sha256: 797bf94f6621b31025c30019c25603ed2bdf7e203317197832174b74260d00c3
Contents?: true
Size: 553 Bytes
Versions: 10
Compression:
Stored size: 553 Bytes
Contents
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
10 entries across 10 versions & 2 rubygems