Sha256: c5583819331dc3c51459a5fa7ba34642ecbe30dc59b3f65d5e3e537a2cf38124

Contents?: true

Size: 696 Bytes

Versions: 6

Compression:

Stored size: 696 Bytes

Contents

require 'ostruct'

class FakeRequest < Struct.new(:http_method, :path, :params, :session, :env)
  alias :request_method :http_method

  attr_reader :logging_msgs

  def initialize(args = nil)
    args ||= {}
    super(*[
      args[:http_method] || 'GET',
      args[:path]        || Factory.path,
      args[:params]      || {},
      args[:session]     || OpenStruct.new,
      args[:env]         || {}
    ])

    self.env.merge!({
      'rack.url_scheme' => Factory.boolean ? 'http' : 'https',
      'HTTP_HOST'       => "#{Factory.string}.#{Factory.string}",

      'deas.logging' => Proc.new do |msg|
        @logging_msgs ||= []
        @logging_msgs.push(msg)
      end
    })
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
deas-0.42.0 test/support/fake_request.rb
deas-0.41.0 test/support/fake_request.rb
deas-0.40.0 test/support/fake_request.rb
deas-0.39.2 test/support/fake_request.rb
deas-0.39.1 test/support/fake_request.rb
deas-0.39.0 test/support/fake_request.rb