Sha256: 9e408b24717155264125c14293786a3d5cdb1a7b1982d7f4118e020c948768ca

Contents?: true

Size: 1.15 KB

Versions: 82

Compression:

Stored size: 1.15 KB

Contents

require "spec_helper"

describe Rack::Test::Session do
  context "HTTP Digest authentication" do

    def app
      app = Rack::Auth::Digest::MD5.new(Rack::Test::FakeApp.new) do |username|
        { 'alice' => 'correct-password' }[username]
      end
      app.realm = 'WallysWorld'
      app.opaque = 'this-should-be-secret'
      app
    end

    it 'incorrectly authenticates GETs' do
      digest_authorize 'foo', 'bar'
      get '/'
      last_response.should be_challenge
    end

    it "correctly authenticates GETs" do
      digest_authorize "alice", "correct-password"
      response = get "/"
      response.should be_ok
    end

    it "correctly authenticates GETs with params" do
      digest_authorize "alice", "correct-password"
      response = get "/", "foo" => "bar"
      response.should be_ok
    end

    it "correctly authenticates POSTs" do
      digest_authorize "alice", "correct-password"
      response = post "/"
      response.should be_ok
    end

    it "returns a re-challenge if authenticating incorrectly" do
      digest_authorize "alice", "incorrect-password"
      response = get "/"
      response.should be_challenge
    end

  end
end

Version data entries

82 entries across 66 versions & 32 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
tdiary-5.0.4 vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
abaci-0.3.0 vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
arcabouco-0.2.13 vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
tdiary-5.0.2 vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
tdiary-5.0.1 vendor/bundle/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/rack-test-0.6.3/spec/rack/test/digest_auth_spec.rb