1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
hsbt 2017-09-11 09:44:29 +00:00
parent b7127e6356
commit bfa3d672d1

View file

@ -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")