Sha256: c32b3229ce24f93ff56e609f35430f619870e8d33f53936fb2b25654a2b96cb0

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 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

5 entries across 5 versions & 1 rubygems

Version Path
usher-0.8.0 spec/spec_helper.rb
usher-0.7.5 spec/spec_helper.rb
usher-0.7.4 spec/spec_helper.rb
usher-0.7.3 spec/spec_helper.rb
usher-0.7.2 spec/spec_helper.rb