diff options
Diffstat (limited to 'test/spec_auth_digest.rb')
-rw-r--r-- | test/spec_auth_digest.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/spec_auth_digest.rb b/test/spec_auth_digest.rb index 7230bb68..cc205aa9 100644 --- a/test/spec_auth_digest.rb +++ b/test/spec_auth_digest.rb @@ -1,4 +1,6 @@ -require 'minitest/autorun' +# frozen_string_literal: true + +require 'minitest/global_expectations/autorun' require 'rack/auth/digest/md5' require 'rack/lint' require 'rack/mock' @@ -11,12 +13,12 @@ describe Rack::Auth::Digest::MD5 do def unprotected_app Rack::Lint.new lambda { |env| friend = Rack::Utils.parse_query(env["QUERY_STRING"])["friend"] - [ 200, {'Content-Type' => 'text/plain'}, ["Hi #{env['REMOTE_USER']}#{friend ? " and #{friend}" : ''}"] ] + [ 200, { 'Content-Type' => 'text/plain' }, ["Hi #{env['REMOTE_USER']}#{friend ? " and #{friend}" : ''}"] ] } end def protected_app - Rack::Auth::Digest::MD5.new(unprotected_app, :realm => realm, :opaque => 'this-should-be-secret') do |username| + Rack::Auth::Digest::MD5.new(unprotected_app, realm: realm, opaque: 'this-should-be-secret') do |username| { 'Alice' => 'correct-password' }[username] end end @@ -158,7 +160,7 @@ describe Rack::Auth::Digest::MD5 do begin Rack::Auth::Digest::Nonce.time_limit = 10 - request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 1 do |response| + request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', wait: 1 do |response| response.status.must_equal 200 response.body.to_s.must_equal 'Hi Alice' response.headers['WWW-Authenticate'].wont_match(/\bstale=true\b/) @@ -172,7 +174,7 @@ describe Rack::Auth::Digest::MD5 do begin Rack::Auth::Digest::Nonce.time_limit = 1 - request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', :wait => 2 do |response| + request_with_digest_auth 'GET', '/', 'Alice', 'correct-password', wait: 2 do |response| assert_digest_auth_challenge response response.headers['WWW-Authenticate'].must_match(/\bstale=true\b/) end @@ -247,7 +249,7 @@ describe Rack::Auth::Digest::MD5 do it 'return application output if correct credentials given for PUT (using method override of POST)' do @request = Rack::MockRequest.new(protected_app_with_method_override) - request_with_digest_auth 'POST', '/', 'Alice', 'correct-password', :input => "_method=put" do |response| + request_with_digest_auth 'POST', '/', 'Alice', 'correct-password', input: "_method=put" do |response| response.status.must_equal 200 response.body.to_s.must_equal 'Hi Alice' end |