aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/vendor/rack-test/rack/test/mock_digest_request.rb
blob: 81c398ba51084a3f8bc2fb23d5e2778db9571281 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module Rack
  module Test

    class MockDigestRequest
      def initialize(params)
        @params = params
      end

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

        super
      end

      def method
        @params['method']
      end

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

  end
end