aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-28 01:16:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-28 01:16:43 +0000
commit2931e59007385514fe8d3e56eba851a29baf43ee (patch)
tree00e91ff57caed712ae08e8b657e8e0a52a030d7c /test/rubygems/test_gem.rb
parent6007b2822e5b8f4e325229cdf8706d83b9ba30d8 (diff)
downloadruby-2931e59007385514fe8d3e56eba851a29baf43ee.tar.gz
rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems to 2.6.7, not the master, with r56225. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem.rb')
-rw-r--r--test/rubygems/test_gem.rb87
1 files changed, 11 insertions, 76 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index b9c0337c0a..787350727f 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -157,35 +157,6 @@ class TestGem < Gem::TestCase
assert_match 'a-2/bin/exec', Gem.bin_path('a', 'exec', '>= 0')
end
- def test_activate_bin_path_resolves_eagerly
- a1 = util_spec 'a', '1' do |s|
- s.executables = ['exec']
- s.add_dependency 'b'
- end
-
- b1 = util_spec 'b', '1' do |s|
- s.add_dependency 'c', '2'
- end
-
- b2 = util_spec 'b', '2' do |s|
- s.add_dependency 'c', '1'
- end
-
- c1 = util_spec 'c', '1'
- c2 = util_spec 'c', '2'
-
- install_specs c1, c2, b1, b2, a1
-
- Gem.activate_bin_path("a", "exec", ">= 0")
-
- # If we didn't eagerly resolve, this would activate c-2 and then the
- # finish_resolve would cause a conflict
- gem 'c'
- Gem.finish_resolve
-
- assert_equal %w(a-1 b-2 c-1), loaded_spec_names
- end
-
def test_self_bin_path_no_exec_name
e = assert_raises ArgumentError do
Gem.bin_path 'a'
@@ -374,7 +345,7 @@ class TestGem < Gem::TestCase
begin
Dir.chdir 'detect/a/b'
- assert_equal [BUNDLER_FULL_NAME], Gem.detect_gemdeps.map(&:full_name)
+ assert_empty Gem.detect_gemdeps
ensure
Dir.chdir @tempdir
end
@@ -1426,7 +1397,7 @@ class TestGem < Gem::TestCase
Gem.detect_gemdeps
- assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1), loaded_spec_names
+ assert_equal %w!a-1 b-1 c-1!, loaded_spec_names
end
def test_auto_activation_of_detected_gemdeps_file
@@ -1449,40 +1420,10 @@ class TestGem < Gem::TestCase
ENV['RUBYGEMS_GEMDEPS'] = "-"
- assert_equal [a, b, util_spec("bundler", Bundler::VERSION), c], Gem.detect_gemdeps.sort_by { |s| s.name }
+ assert_equal [a,b,c], Gem.detect_gemdeps.sort_by { |s| s.name }
end
LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
- BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
- BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
-
- def test_use_gemdeps_uses_bundler_postit_trampoline
- refute_includes $LOADED_FEATURES, File.join(BUNDLER_LIB_PATH, "bundler/postit_trampoline.rb".dup.untaint)
- ENV.delete("BUNDLE_DISABLE_POSTIT")
-
- a = new_spec "a", "1", nil, "lib/a.rb"
- b = new_spec "b", "1", nil, "lib/b.rb"
- c = new_spec "c", "1", nil, "lib/c.rb"
-
- 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
-
- ENV['RUBYGEMS_GEMDEPS'] = path
-
- Gem.detect_gemdeps
-
- assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1), loaded_spec_names
-
- trampoline_path = RUBY_VERSION > "1.9" ? File.join(BUNDLER_LIB_PATH, "bundler/postit_trampoline.rb".dup.untaint) : "bundler/postit_trampoline.rb"
- assert_includes $LOADED_FEATURES, trampoline_path
- end
def test_looks_for_gemdeps_files_automatically_on_start
util_clear_gems
@@ -1509,9 +1450,9 @@ class TestGem < Gem::TestCase
ENV['GEM_PATH'] = path
ENV['RUBYGEMS_GEMDEPS'] = "-"
- out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -I "#{BUNDLER_LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
+ out = `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
- assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1).inspect, out.strip
+ assert_equal '["a-1", "b-1", "c-1"]', out.strip
end
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
@@ -1541,12 +1482,12 @@ class TestGem < Gem::TestCase
Dir.mkdir "sub1"
out = Dir.chdir "sub1" do
- `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -I "#{BUNDLER_LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
+ `#{Gem.ruby.dup.untaint} -I "#{LIB_PATH.untaint}" -rubygems -e "p Gem.loaded_specs.values.map(&:full_name).sort"`
end
Dir.rmdir "sub1"
- assert_equal %W(a-1 b-1 #{BUNDLER_FULL_NAME} c-1).inspect, out.strip
+ assert_equal '["a-1", "b-1", "c-1"]', out.strip
end
def test_register_default_spec
@@ -1620,7 +1561,7 @@ class TestGem < Gem::TestCase
Gem.use_gemdeps gem_deps_file
- assert_equal %W(a-1 #{BUNDLER_FULL_NAME}), loaded_spec_names
+ assert spec.activated?
refute_nil Gem.gemdeps
end
@@ -1681,7 +1622,7 @@ class TestGem < Gem::TestCase
Gem.use_gemdeps
- assert_equal %W(a-1 #{BUNDLER_FULL_NAME}), loaded_spec_names
+ assert spec.activated?
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end
@@ -1723,14 +1664,8 @@ class TestGem < Gem::TestCase
io.write 'gem "a"'
end
- platform = Bundler::GemHelpers.generic_local_platform
- if platform == Gem::Platform::RUBY
- platform = ''
- else
- platform = " #{platform}"
- end
expected = <<-EXPECTED
-Could not find gem 'a#{platform}' in any of the gem sources listed in your Gemfile or available on this machine.
+Unable to resolve dependency: user requested 'a (>= 0)'
You may need to `gem install -g` to install missing gems
EXPECTED
@@ -1758,7 +1693,7 @@ You may need to `gem install -g` to install missing gems
Gem.use_gemdeps
- assert_equal %W(a-1 #{BUNDLER_FULL_NAME}), loaded_spec_names
+ assert spec.activated?
ensure
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
end