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.


4
5
6
# File 'lib/rack/test/mock_digest_request.rb', line 4

def initialize(params)
  @params = params
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym) ⇒ Object


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

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

  super
end

Instance Method Details

#methodObject


16
17
18
# File 'lib/rack/test/mock_digest_request.rb', line 16

def method
  @params['method']
end

#response(password) ⇒ Object


20
21
22
# File 'lib/rack/test/mock_digest_request.rb', line 20

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