test/spec_auth_digest.rb in rack-1.3.6 vs test/spec_auth_digest.rb in rack-1.3.7

- old
+ new

@@ -150,9 +150,23 @@ request_with_digest_auth 'GET', '/', 'Bob', '' do |response| assert_digest_auth_challenge response end end + should 'not rechallenge if nonce is not stale' do + begin + Rack::Auth::Digest::Nonce.time_limit = 10 + + request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 1 do |response| + response.status.should.equal 200 + response.body.to_s.should.equal 'Hi Alice' + response.headers['WWW-Authenticate'].should.not =~ /\bstale=true\b/ + end + ensure + Rack::Auth::Digest::Nonce.time_limit = nil + end + end + should 'rechallenge with stale parameter if nonce is stale' do begin Rack::Auth::Digest::Nonce.time_limit = 1 request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 2 do |response|