summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-04 01:04:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-04 01:04:14 +0000
commitfbdec8186e96c48c724ba620ec6f64128999aaf2 (patch)
treeaaabfc4409b4d3fdeedf7264bba45ed343e8fee4 /test/rubygems
parent02887a56e57b721463c3cda4c4912e56f68d3468 (diff)
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
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem.rb57
1 files changed, 34 insertions, 23 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index e1ebebffb5..0b533c5f31 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1434,14 +1434,6 @@ class TestGem < Gem::TestCase
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")
install_gem a, :install_dir => path
install_gem b, :install_dir => path
@@ -1450,10 +1442,24 @@ class TestGem < Gem::TestCase
ENV['GEM_PATH'] = path
ENV['RUBYGEMS_GEMDEPS'] = "-"
- out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
- out.sub!(/, "openssl-#{Gem::Version::VERSION_PATTERN}"/, "")
+ path = File.join @tempdir, "gem.deps.rb"
+
+ 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 '["a-1", "b-1", "c-1"]', out.strip
+ assert_equal ["b-1", "c-1"], out - out0
end
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
- 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")
install_gem a, :install_dir => path
install_gem b, :install_dir => path
@@ -1482,14 +1480,27 @@ class TestGem < Gem::TestCase
ENV['RUBYGEMS_GEMDEPS'] = "-"
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
+ 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.sub!(/, "openssl-#{Gem::Version::VERSION_PATTERN}"/, "")
+ 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"
- assert_equal '["a-1", "b-1", "c-1"]', out.strip
+ assert_equal ["b-1", "c-1"], out - out0
end
def test_register_default_spec