Sha256: 1aaf23c4657d8e71e4e3cd5ea42dca96d2eacff95eaee3febf4d2af99f3233a7

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

Stored size: 1.05 KB

Contents

require 'mechanize/test_case'

class TestMechanizeHttpAuthRealm < Mechanize::TestCase

  def setup
    super

    @uri = URI 'http://example/'
    @AR = Mechanize::HTTP::AuthRealm
    @realm = @AR.new 'Digest', @uri, 'r'
  end

  def test_initialize
    assert_equal 'r', @realm.realm

    realm = @AR.new 'Digest', @uri, 'R'
    refute_equal 'r', realm.realm

    realm = @AR.new 'Digest', @uri, 'R'
    assert_equal 'R', realm.realm

    realm = @AR.new 'Digest', @uri, nil
    assert_nil realm.realm
  end

  def test_equals2
    other = @realm.dup
    assert_equal @realm, other

    other = @AR.new 'Basic', @uri, 'r'
    refute_equal @realm, other

    other = @AR.new 'Digest', URI('http://other.example/'), 'r'
    refute_equal @realm, other

    other = @AR.new 'Digest', @uri, 'R'
    refute_equal @realm, other

    other = @AR.new 'Digest', @uri, 's'
    refute_equal @realm, other
  end

  def test_hash
    h = {}
    h[@realm] = 1

    other = @realm.dup
    assert_equal 1, h[other]

    other = @AR.new 'Basic', @uri, 'r'
    assert_nil h[other]
  end

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
mechanize-2.10.0 test/test_mechanize_http_auth_realm.rb
mechanize-2.9.2 test/test_mechanize_http_auth_realm.rb
mechanize-2.9.1 test/test_mechanize_http_auth_realm.rb
mechanize-2.9.0 test/test_mechanize_http_auth_realm.rb
mechanize-2.8.5 test/test_mechanize_http_auth_realm.rb
mechanize-2.8.4 test/test_mechanize_http_auth_realm.rb
mechanize-2.8.3 test/test_mechanize_http_auth_realm.rb
mechanize-2.8.2 test/test_mechanize_http_auth_realm.rb
mechanize-2.8.1 test/test_mechanize_http_auth_realm.rb
mechanize-2.8.0 test/test_mechanize_http_auth_realm.rb
mechanize-2.7.7 test/test_mechanize_http_auth_realm.rb
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_http_auth_realm.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_http_auth_realm.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_http_auth_realm.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_http_auth_realm.rb
mechanize-2.7.6 test/test_mechanize_http_auth_realm.rb
mechanize-2.7.5 test/test_mechanize_http_auth_realm.rb