ruby-changes:47723
From: hsbt <ko1@a...>
Date: Mon, 11 Sep 2017 18:44:35 +0900 (JST)
Subject: [ruby-changes:47723] hsbt:r59839 (trunk): Backport test_realworld_default_gem test from Rubygems-2.6.13.
hsbt 2017-09-11 18:44:29 +0900 (Mon, 11 Sep 2017) New Revision: 59839 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59839 Log: Backport test_realworld_default_gem test from Rubygems-2.6.13. But this test is always fail on ruby core repository. Because default gems is only availabled after installation of Ruby. I ignored this test at https://github.com/rubygems/rubygems/pull/1986 Modified files: trunk/test/rubygems/test_require.rb Index: test/rubygems/test_require.rb =================================================================== --- test/rubygems/test_require.rb (revision 59838) +++ test/rubygems/test_require.rb (revision 59839) @@ -301,6 +301,23 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L301 assert_equal %w(default-2.0.0.0), loaded_spec_names end + def test_realworld_default_gem + skip "no default gems on ruby < 2.0" unless RUBY_VERSION >= "2" + begin + gem 'json' + rescue Gem::MissingSpecError + skip "default gems are only available after ruby installation" + end + + cmd = <<-RUBY + $stderr = $stdout + require "json" + puts Gem.loaded_specs["json"].default_gem? + RUBY + output = Gem::Util.popen(Gem.ruby, "-e", cmd).strip + assert_equal "true", output + end + def test_default_gem_and_normal_gem default_gem_spec = new_default_spec("default", "2.0.0.0", nil, "default/gem.rb") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/