diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-11 09:44:29 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-11 09:44:29 +0000 |
commit | bfa3d672d14df15fb286b1609c5faaa4d0094000 (patch) | |
tree | 652f7beb8e8372d2a39ab0cf182cf22cfb361c5b /test | |
parent | b7127e63566628ff056c71bef27f22b8f1c8f574 (diff) | |
download | ruby-bfa3d672d14df15fb286b1609c5faaa4d0094000.tar.gz |
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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/rubygems/test_require.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index dd606e44d4..edb36f1f32 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -301,6 +301,23 @@ class TestGemRequire < Gem::TestCase 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") |