Sha256: c876637099ac56f8b098d7e0454ecd0e104715081460cfb04c89833ea375d48e

Contents?: true

Size: 1.29 KB

Versions: 26

Compression:

Stored size: 1.29 KB

Contents

require_relative 'helper'
require 'rubygems/uri'

class TestUri < Gem::TestCase
  def test_to_s_not_string
    assert_equal "not_a_uri", Gem::Uri.new(:not_a_uri).to_s
  end

  def test_to_s_invalid_uri
    assert_equal "https://www.example.com:80index", Gem::Uri.new("https://www.example.com:80index").to_s
  end

  def test_redacted_with_user_pass
    assert_equal "https://user:REDACTED@example.com", Gem::Uri.new("https://user:pass@example.com").redacted.to_s
  end

  def test_redacted_with_token
    assert_equal "https://REDACTED@example.com", Gem::Uri.new("https://token@example.com").redacted.to_s
  end

  def test_redacted_with_user_x_oauth_basic
    assert_equal "https://REDACTED:x-oauth-basic@example.com", Gem::Uri.new("https://token:x-oauth-basic@example.com").redacted.to_s
  end

  def test_redacted_without_credential
    assert_equal "https://www.example.com", Gem::Uri.new("https://www.example.com").redacted.to_s
  end

  def test_redacted_with_invalid_uri
    assert_equal "https://www.example.com:80index", Gem::Uri.new("https://www.example.com:80index").redacted.to_s
  end

  def test_redacted_does_not_modify_uri
    url = 'https://user:password@example.com'
    uri = Gem::Uri.new(url)
    assert_equal 'https://user:REDACTED@example.com', uri.redacted.to_s
    assert_equal url, uri.to_s
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rubygems-update-3.2.34 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.18 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.17 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.16 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.15 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.14 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.13 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.12 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.11 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.10 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.9 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.8 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.7 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.6 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.5 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.4 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.3 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.2 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.1 test/rubygems/test_gem_uri.rb
rubygems-update-3.3.0 test/rubygems/test_gem_uri.rb