1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rubygems/test_gem_source_list.rb
drbrain a6c92a85e4 * lib/rubygems/available_set.rb: Undent for style
* lib/rubygems/dependency_installer.rb:  Pick latest prerelease gem to
  install.  Fixes RubyGems bug #468.
* test/rubygems/test_gem_dependency_installer.rb:  Test for the above.

* lib/rubygems/dependency_installer.rb:  Don't display "Done installing
  documentation" if documentation will not be installed.
* lib/rubygems/rdoc.rb:  ditto

* lib/rubygems/dependency_list.rb:  Use Array#concat for Ruby 1.x
  performance.

* lib/rubygems/installer.rb:  Use formatted program name when comparing
  executables.  RubyGems pull request #471
* test/rubygems/test_gem_installer.rb:  Test for the above.

* lib/rubygems/package.rb:  Use more explicit feature check to work
  around JRuby bug #552

* lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem:  Added GeoTrust root
  certificate.

* test/rubygems/test_gem_source_list.rb:  Use "example" instead of real
  hostname


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-27 23:20:57 +00:00

87 lines
1.7 KiB
Ruby

require 'rubygems/source_list'
require 'rubygems/test_case'
class TestGemSourceList < Gem::TestCase
def setup
super
@uri = "http://example"
@source = Gem::Source.new(@uri)
@sl = Gem::SourceList.new
@sl << @source
end
def test_self_from
sl = Gem::SourceList.from [@uri]
assert_equal [Gem::Source.new(@uri)], sl.sources
end
def test_append
sl = Gem::SourceList.new
source = (sl << @uri)
assert_kind_of Gem::Source, source
assert_kind_of URI, source.uri
assert_equal source.uri.to_s, @uri
assert_equal [source], sl.sources
end
def test_replace
sl = Gem::SourceList.new
sl.replace [@uri]
assert_equal [@source], sl.sources
end
def test_each
@sl.each do |x|
assert_equal @uri, x
end
end
def test_each_source
@sl.each_source do |x|
assert_equal @source, x
end
end
def test_equal_to_another_list
sl2 = Gem::SourceList.new
sl2 << Gem::Source.new(@uri)
assert @sl == sl2, "lists not equal"
end
def test_equal_to_array
assert @sl == [@uri], "lists not equal"
end
def test_to_a
assert_equal @sl.to_a, [@uri]
end
def test_include_eh
assert @sl.include?(@uri), "string comparison not working"
assert @sl.include?(URI.parse(@uri)), "uri comparison not working"
end
def test_include_matches_a_source
assert @sl.include?(@source), "source comparison not working"
assert @sl.include?(Gem::Source.new(@uri)), "source comparison not working"
end
def test_delete
@sl.delete @uri
assert_equal @sl.sources, []
end
def test_delete_a_source
@sl.delete Gem::Source.new(@uri)
assert_equal @sl.sources, []
end
end