Skip to content

Commit

Permalink
[rubygems/rubygems] Remove unnecessary tests
Browse files Browse the repository at this point in the history
We will be passing string to this class so there is no need to be defensive about it.

rubygems/rubygems@30bd52a977
  • Loading branch information
daniel-niknam authored and hsbt committed Aug 31, 2021
1 parent 1948ac2 commit ceba866
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions test/rubygems/test_gem_printable_uri.rb
@@ -1,24 +1,11 @@
require_relative 'helper'
require 'uri'
require 'rubygems/printable_uri'

class TestPrintableUri < Gem::TestCase
def test_parsed_uri
assert_equal true, Gem::PrintableUri.parse_uri("https://www.example.com").valid_uri?
end

def test_valid_uri_with_empty_uri_object
assert_equal true, Gem::PrintableUri.parse_uri(URI("")).valid_uri?
end

def test_valid_uri_with_valid_uri_object
assert_equal true, Gem::PrintableUri.parse_uri(URI("https://www.example.com")).valid_uri?
end

def test_valid_uri_with_other_objects
assert_equal false, Gem::PrintableUri.parse_uri(Object.new).valid_uri?
end

def test_valid_uri_with_invalid_uri
assert_equal false, Gem::PrintableUri.parse_uri("https://www.example.com:80index").valid_uri?
end
Expand All @@ -35,14 +22,6 @@ def test_original_password_without_credential
assert_equal nil, Gem::PrintableUri.parse_uri("https://www.example.com").original_password
end

def test_original_password_with_empty_uri_object
assert_equal nil, Gem::PrintableUri.parse_uri(URI("")).original_password
end

def test_original_password_with_valid_uri_object
assert_equal "pass", Gem::PrintableUri.parse_uri(URI("https://user:pass@example.com")).original_password
end

def test_to_s_with_user_pass
assert_equal "https://user:REDACTED@example.com", Gem::PrintableUri.parse_uri("https://user:pass@example.com").to_s
end
Expand All @@ -62,19 +41,4 @@ def test_to_s_without_credential
def test_to_s_with_invalid_uri
assert_equal "https://www.example.com:80index", Gem::PrintableUri.parse_uri("https://www.example.com:80index").to_s
end

def test_to_s_with_empty_uri_object
assert_equal "", Gem::PrintableUri.parse_uri(URI("")).to_s
end

def test_to_s_with_valid_uri_object
assert_equal "https://user:REDACTED@example.com", Gem::PrintableUri.parse_uri(URI("https://user:pass@example.com")).to_s
end

def test_to_s_with_other_objects
obj = Object.new
obj.stub(:to_s, "my-to-s") do
assert_equal "my-to-s", Gem::PrintableUri.parse_uri(obj).to_s
end
end
end

0 comments on commit ceba866

Please sign in to comment.