Class: Rack::Test::MockDigestRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/test/mock_digest_request.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ MockDigestRequest

Returns a new instance of MockDigestRequest.



6
7
8
# File 'lib/rack/test/mock_digest_request.rb', line 6

def initialize(params)
  @params = params
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rack/test/mock_digest_request.rb', line 10

def method_missing(sym)
  if @params.has_key? k = sym.to_s
    return @params[k]
  end

  super
end

Instance Method Details

#methodObject



18
19
20
# File 'lib/rack/test/mock_digest_request.rb', line 18

def method
  @params['method']
end

#response(password) ⇒ Object



22
23
24
# File 'lib/rack/test/mock_digest_request.rb', line 22

def response(password)
  Rack::Auth::Digest::MD5.new(nil).send :digest, self, password
end