Sha256: 80a89404829d0b0c333da5c6960f4242655b01b30b51fe6b565e9f5f20784259

Contents?: true

Size: 649 Bytes

Versions: 3

Compression:

Stored size: 649 Bytes

Contents

libdir = File.expand_path("lib")
$:.unshift(libdir) unless $:.include?(libdir)

require 'usher'

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

3 entries across 3 versions & 1 rubygems

Version Path
usher-0.8.3 spec/spec_helper.rb
usher-0.8.2 spec/spec_helper.rb
usher-0.8.1 spec/spec_helper.rb