diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-06 06:01:14 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-06 06:01:14 +0000 |
commit | 469bac0f9233d8ad2b53bea2f382578634fabf65 (patch) | |
tree | ecb999b03efbe4272614f2ffb4069a3f2b8bbabe /test/rubygems | |
parent | ea736d55f9596e79184b9b4ade439c71530e86d8 (diff) |
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.3.
Please see entries of 2.6.3 on
https://github.com/rubygems/rubygems/blob/master/History.txt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_bundled_ca.rb | 6 | ||||
-rw-r--r-- | test/rubygems/test_gem.rb | 19 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_environment_command.rb | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_owner_command.rb | 7 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_query_command.rb | 20 | ||||
-rw-r--r-- | test/rubygems/test_gem_commands_setup_command.rb | 8 | ||||
-rw-r--r-- | test/rubygems/test_gem_dependency.rb | 4 | ||||
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 15 | ||||
-rw-r--r-- | test/rubygems/test_kernel.rb | 2 |
9 files changed, 69 insertions, 14 deletions
diff --git a/test/rubygems/test_bundled_ca.rb b/test/rubygems/test_bundled_ca.rb index f3da13b1b5..5ce2850518 100644 --- a/test/rubygems/test_bundled_ca.rb +++ b/test/rubygems/test_bundled_ca.rb @@ -17,7 +17,7 @@ if ENV["TRAVIS"] || ENV["TEST_SSL"] store = OpenSSL::X509::Store.new ssl_cert_glob = - File.expand_path '../../../lib/rubygems/ssl_certs/*.pem', THIS_FILE + File.expand_path '../../../lib/rubygems/ssl_certs/*/*.pem', THIS_FILE Dir[ssl_cert_glob].each do |ssl_cert| store.add_file ssl_cert @@ -55,5 +55,9 @@ if ENV["TRAVIS"] || ENV["TEST_SSL"] assert_https('rubygems.global.ssl.fastly.net') end + def test_accessing_new_index + assert_https('fastly.rubygems.org') + end + end end diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 931c9e498d..81b2c01519 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -973,6 +973,19 @@ class TestGem < Gem::TestCase assert Gem.try_activate('b'), 'try_activate should still return true' end + def test_spec_order_is_consistent + b1 = util_spec 'b', '1.0' + b2 = util_spec 'b', '2.0' + b3 = util_spec 'b', '3.0' + + install_specs b1, b2, b3 + + specs1 = Gem::Specification.stubs.find_all { |s| s.name == 'b' } + Gem::Specification.reset + specs2 = Gem::Specification.stubs_for('b') + assert_equal specs1.map(&:version), specs2.map(&:version) + end + def test_self_try_activate_missing_dep b = util_spec 'b', '1.0' a = util_spec 'a', '1.0', 'b' => '>= 1.0' @@ -986,7 +999,7 @@ class TestGem < Gem::TestCase io.puts '# a_file.rb' end - e = assert_raises Gem::LoadError do + e = assert_raises Gem::MissingSpecError do Gem.try_activate 'a_file' end @@ -1006,7 +1019,7 @@ class TestGem < Gem::TestCase io.puts '# a_file.rb' end - e = assert_raises Gem::LoadError do + e = assert_raises Gem::MissingSpecError do Gem.try_activate 'a_file' end @@ -1070,7 +1083,7 @@ class TestGem < Gem::TestCase 'GEM_PATH' => [Gem.paths.home, 'foo'] } end assert_equal [Gem.paths.home, 'foo'], Gem.paths.path - assert_match(/Array values in the parameter are deprecated. Please use a String or nil/, stderr) + assert_match(/Array values in the parameter to `Gem.paths=` are deprecated.\nPlease use a String or nil/m, stderr) assert_equal '', stdout end diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb index 7ffcbb5454..040e5c4c39 100644 --- a/test/rubygems/test_gem_commands_environment_command.rb +++ b/test/rubygems/test_gem_commands_environment_command.rb @@ -23,7 +23,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase end assert_match %r|RUBYGEMS VERSION: (\d\.)+\d|, @ui.output - assert_match %r|RUBY VERSION: \d\.\d\.\d \(.*\) \[.*\]|, @ui.output + assert_match %r|RUBY VERSION: \d+\.\d+\.\d+ \(.*\) \[.*\]|, @ui.output assert_match %r|INSTALLATION DIRECTORY: #{Regexp.escape @gemhome}|, @ui.output assert_match %r|RUBYGEMS PREFIX: |, @ui.output diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb index 7217f5cff0..44652c1093 100644 --- a/test/rubygems/test_gem_commands_owner_command.rb +++ b/test/rubygems/test_gem_commands_owner_command.rb @@ -19,7 +19,12 @@ class TestGemCommandsOwnerCommand < Gem::TestCase response = <<EOF --- - email: user1@example.com + id: 1 + handle: user1 - email: user2@example.com +- id: 3 + handle: user3 +- id: 4 EOF @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK'] @@ -34,6 +39,8 @@ EOF assert_match %r{Owners for gem: freewill}, @ui.output assert_match %r{- user1@example.com}, @ui.output assert_match %r{- user2@example.com}, @ui.output + assert_match %r{- user3}, @ui.output + assert_match %r{- 4}, @ui.output end def test_show_owners_setting_up_host_through_env_var diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb index 78c15a1770..223f205b2d 100644 --- a/test/rubygems/test_gem_commands_query_command.rb +++ b/test/rubygems/test_gem_commands_query_command.rb @@ -537,6 +537,26 @@ a (2 universal-darwin, 1 ruby x86-linux) assert_equal '', @ui.error end + def test_execute_show_default_gems + spec_fetcher { |fetcher| fetcher.spec 'a', 2 } + + a1 = new_default_spec 'a', 1 + install_default_specs a1 + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF + +*** LOCAL GEMS *** + +a (2, default: 1) +EOF + + assert_equal expected, @ui.output + end + def test_execute_default_details spec_fetcher do |fetcher| fetcher.spec 'a', 2 diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index e0c4f20b41..ae3d0500dc 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -14,16 +14,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase @cmd.options[:prefix] = @install_dir FileUtils.mkdir_p 'bin' - FileUtils.mkdir_p 'lib/rubygems/ssl_certs' + FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org' open 'bin/gem', 'w' do |io| io.puts '# gem' end open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end - open 'lib/rubygems/ssl_certs/foo.pem', 'w' do |io| io.puts 'PEM' end + open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end end def test_pem_files_in - assert_equal %w[rubygems/ssl_certs/foo.pem], + assert_equal %w[rubygems/ssl_certs/rubygems.org/foo.pem], @cmd.pem_files_in('lib').sort end @@ -39,7 +39,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase @cmd.install_lib dir assert_path_exists File.join(dir, 'rubygems.rb') - assert_path_exists File.join(dir, 'rubygems/ssl_certs/foo.pem') + assert_path_exists File.join(dir, 'rubygems/ssl_certs/rubygems.org/foo.pem') end end diff --git a/test/rubygems/test_gem_dependency.rb b/test/rubygems/test_gem_dependency.rb index cbc741c3c4..0d501f567f 100644 --- a/test/rubygems/test_gem_dependency.rb +++ b/test/rubygems/test_gem_dependency.rb @@ -331,7 +331,7 @@ class TestGemDependency < Gem::TestCase dep = Gem::Dependency.new "a", "= 2.0" - e = assert_raises Gem::LoadError do + e = assert_raises Gem::MissingSpecVersionError do dep.to_specs end @@ -350,7 +350,7 @@ class TestGemDependency < Gem::TestCase dep = Gem::Dependency.new "b", "= 2.0" - e = assert_raises Gem::LoadError do + e = assert_raises Gem::MissingSpecError do dep.to_specs end diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index bc1c8d2ca7..8598e924ff 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -100,6 +100,17 @@ end load 'rubygems/syck_hack.rb' end + def test_self_find_active_stub_by_path + spec = new_spec('a', '1', nil, 'lib/foo.rb') + spec.activated = true + + # There used to be a bug (introduced in a9c1aaf) when Gem::Specification + # objects are present in the @stubs collection. This test verifies that + # this scenario works correctly. + Gem::Specification.all = [spec] + Gem::Specification.find_active_stub_by_path('foo') + end + def test_self_activate foo = util_spec 'foo', '1' @@ -3373,7 +3384,7 @@ end assert Gem::Specification.find_by_name "a", "1" assert Gem::Specification.find_by_name "a", ">1" - assert_raises Gem::LoadError do + assert_raises Gem::MissingSpecError do Gem::Specification.find_by_name "monkeys" end end @@ -3387,7 +3398,7 @@ end assert Gem::Specification.find_by_name "b" - assert_raises Gem::LoadError do + assert_raises Gem::MissingSpecVersionError do Gem::Specification.find_by_name "b", "1" end diff --git a/test/rubygems/test_kernel.rb b/test/rubygems/test_kernel.rb index e6e11b8efb..b565c62f4a 100644 --- a/test/rubygems/test_kernel.rb +++ b/test/rubygems/test_kernel.rb @@ -66,7 +66,7 @@ class TestKernel < Gem::TestCase def test_gem_env_req ENV["GEM_REQUIREMENT_A"] = '~> 2.0' - assert_raises(Gem::LoadError) { gem('a', '= 1') } + assert_raises(Gem::MissingSpecVersionError) { gem('a', '= 1') } assert gem('a', '> 1') assert_equal @a2, Gem.loaded_specs['a'] end |