summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_source_fetch_problem.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_source_fetch_problem.rb')
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/rubygems/test_gem_source_fetch_problem.rb b/test/rubygems/test_gem_source_fetch_problem.rb
index 1a0545a893..6d8ef360ae 100644
--- a/test/rubygems/test_gem_source_fetch_problem.rb
+++ b/test/rubygems/test_gem_source_fetch_problem.rb
@@ -1,26 +1,37 @@
# frozen_string_literal: true
-require 'rubygems/test_case'
+
+require_relative "helper"
class TestGemSourceFetchProblem < Gem::TestCase
def test_exception
source = Gem::Source.new @gem_repo
- error = RuntimeError.new 'test'
+ error = RuntimeError.new "test"
sf = Gem::SourceFetchProblem.new source, error
- e = assert_raises RuntimeError do
+ e = assert_raise RuntimeError do
raise sf
end
- assert_equal 'test', e.message
+ assert_equal "test", e.message
end
def test_password_redacted
- source = Gem::Source.new 'https://username:secret@gemsource.com'
- error = RuntimeError.new 'test'
+ source = Gem::Source.new "https://username:secret@gemsource.com"
+ error = RuntimeError.new "test"
+
+ sf = Gem::SourceFetchProblem.new source, error
+
+ refute_match sf.wordy, "secret"
+ end
+
+ def test_source_password_no_redacted
+ source = Gem::Source.new "https://username:secret@gemsource.com"
+ error = RuntimeError.new "test"
sf = Gem::SourceFetchProblem.new source, error
+ sf.wordy
- refute_match sf.wordy, 'secret'
+ assert_match "secret", source.uri.to_s
end
end