Sha256: 24c63cad6dd7b034bc1434de31697be6e14938a864b4364e1a109d0ace0d2a73

Contents?: true

Size: 697 Bytes

Versions: 6

Compression:

Stored size: 697 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.43.5 test/support/fake_request.rb
deas-0.43.4 test/support/fake_request.rb
deas-0.43.3 test/support/fake_request.rb
deas-0.43.2 test/support/fake_request.rb
deas-0.43.1 test/support/fake_request.rb
deas-0.43.0 test/support/fake_request.rb