2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2013-10-15 20:14:16 -04:00
|
|
|
require 'rubygems/test_case'
|
|
|
|
|
|
|
|
class TestGemSourceFetchProblem < Gem::TestCase
|
|
|
|
|
|
|
|
def test_exception
|
|
|
|
source = Gem::Source.new @gem_repo
|
|
|
|
error = RuntimeError.new 'test'
|
|
|
|
|
|
|
|
sf = Gem::SourceFetchProblem.new source, error
|
|
|
|
|
|
|
|
e = assert_raises RuntimeError do
|
|
|
|
raise sf
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_equal 'test', e.message
|
|
|
|
end
|
|
|
|
|
2016-04-27 20:33:08 -04:00
|
|
|
def test_password_redacted
|
|
|
|
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
|
2019-02-14 07:59:03 -05:00
|
|
|
|
2013-10-15 20:14:16 -04:00
|
|
|
end
|