mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_gem.rb: exclude default gems
* test/rubygems/test_gem.rb: check difference to exclude default gems from the expected results. [Feature #13186] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02887a56e5
commit
fbdec8186e
1 changed files with 34 additions and 23 deletions
|
@ -1434,14 +1434,6 @@ class TestGem < Gem::TestCase
|
||||||
|
|
||||||
install_specs a, b, c
|
install_specs a, b, c
|
||||||
|
|
||||||
path = File.join @tempdir, "gem.deps.rb"
|
|
||||||
|
|
||||||
File.open path, "w" do |f|
|
|
||||||
f.puts "gem 'a'"
|
|
||||||
f.puts "gem 'b'"
|
|
||||||
f.puts "gem 'c'"
|
|
||||||
end
|
|
||||||
|
|
||||||
path = File.join(@tempdir, "gd-tmp")
|
path = File.join(@tempdir, "gd-tmp")
|
||||||
install_gem a, :install_dir => path
|
install_gem a, :install_dir => path
|
||||||
install_gem b, :install_dir => path
|
install_gem b, :install_dir => path
|
||||||
|
@ -1450,10 +1442,24 @@ class TestGem < Gem::TestCase
|
||||||
ENV['GEM_PATH'] = path
|
ENV['GEM_PATH'] = path
|
||||||
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
||||||
|
|
||||||
out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
|
path = File.join @tempdir, "gem.deps.rb"
|
||||||
out.sub!(/, "openssl-#{Gem::Version::VERSION_PATTERN}"/, "")
|
|
||||||
|
|
||||||
assert_equal '["a-1", "b-1", "c-1"]', out.strip
|
File.open path, "w" do |f|
|
||||||
|
f.puts "gem 'a'"
|
||||||
|
end
|
||||||
|
out0 = IO.popen([Gem.ruby.dup.untaint, "-I#{LIB_PATH}", "-rubygems",
|
||||||
|
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
||||||
|
&:read).split(/\n/)
|
||||||
|
|
||||||
|
File.open path, "a" do |f|
|
||||||
|
f.puts "gem 'b'"
|
||||||
|
f.puts "gem 'c'"
|
||||||
|
end
|
||||||
|
out = IO.popen([Gem.ruby.dup.untaint, "-I#{LIB_PATH}", "-rubygems",
|
||||||
|
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
||||||
|
&:read).split(/\n/)
|
||||||
|
|
||||||
|
assert_equal ["b-1", "c-1"], out - out0
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
||||||
|
@ -1465,14 +1471,6 @@ class TestGem < Gem::TestCase
|
||||||
|
|
||||||
install_specs a, b, c
|
install_specs a, b, c
|
||||||
|
|
||||||
path = File.join @tempdir, "gem.deps.rb"
|
|
||||||
|
|
||||||
File.open path, "w" do |f|
|
|
||||||
f.puts "gem 'a'"
|
|
||||||
f.puts "gem 'b'"
|
|
||||||
f.puts "gem 'c'"
|
|
||||||
end
|
|
||||||
|
|
||||||
path = File.join(@tempdir, "gd-tmp")
|
path = File.join(@tempdir, "gd-tmp")
|
||||||
install_gem a, :install_dir => path
|
install_gem a, :install_dir => path
|
||||||
install_gem b, :install_dir => path
|
install_gem b, :install_dir => path
|
||||||
|
@ -1482,14 +1480,27 @@ class TestGem < Gem::TestCase
|
||||||
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
ENV['RUBYGEMS_GEMDEPS'] = "-"
|
||||||
|
|
||||||
Dir.mkdir "sub1"
|
Dir.mkdir "sub1"
|
||||||
out = Dir.chdir "sub1" do
|
|
||||||
`#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
|
path = File.join @tempdir, "gem.deps.rb"
|
||||||
|
|
||||||
|
File.open path, "w" do |f|
|
||||||
|
f.puts "gem 'a'"
|
||||||
end
|
end
|
||||||
out.sub!(/, "openssl-#{Gem::Version::VERSION_PATTERN}"/, "")
|
out0 = IO.popen([Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH}", "-rubygems",
|
||||||
|
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
||||||
|
&:read).split(/\n/)
|
||||||
|
|
||||||
|
File.open path, "a" do |f|
|
||||||
|
f.puts "gem 'b'"
|
||||||
|
f.puts "gem 'c'"
|
||||||
|
end
|
||||||
|
out = IO.popen([Gem.ruby.dup.untaint, "-Csub1", "-I#{LIB_PATH}", "-rubygems",
|
||||||
|
"-eputs Gem.loaded_specs.values.map(&:full_name).sort"],
|
||||||
|
&:read).split(/\n/)
|
||||||
|
|
||||||
Dir.rmdir "sub1"
|
Dir.rmdir "sub1"
|
||||||
|
|
||||||
assert_equal '["a-1", "b-1", "c-1"]', out.strip
|
assert_equal ["b-1", "c-1"], out - out0
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_register_default_spec
|
def test_register_default_spec
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue