summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_dependency_installer.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-02-01 16:17:16 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-03-08 13:47:35 +0900
commit53468cc11147b0d285fc376fc546b677dad600ca (patch)
treeeb9c97f544d089be2d324126b025b11f41a22c90 /test/rubygems/test_gem_dependency_installer.rb
parent2ab6b7a7516e1b2c48a66ce513afabb62d101461 (diff)
Sync latest development version of bundler & rubygems
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4143
Diffstat (limited to 'test/rubygems/test_gem_dependency_installer.rb')
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb45
1 files changed, 27 insertions, 18 deletions
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 85dba54675..c62a3f355a 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -44,7 +44,7 @@ class TestGemDependencyInstaller < Gem::TestCase
s.add_development_dependency 'c'
end
- util_reset_gems
+ util_setup_spec_fetcher(@a1, @a1_pre, @b1, @d1)
end
def test_install
@@ -287,8 +287,6 @@ class TestGemDependencyInstaller < Gem::TestCase
@aa1, @aa1_gem = util_gem 'aa', '1'
- util_reset_gems
-
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @aa1_gem, @tempdir
FileUtils.mv @b1_gem, @tempdir
@@ -307,8 +305,6 @@ class TestGemDependencyInstaller < Gem::TestCase
@aa1, @aa1_gem = util_gem 'aa', '1'
- util_reset_gems
-
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @aa1_gem, @tempdir
FileUtils.mv @b1_gem, @tempdir
@@ -329,8 +325,6 @@ class TestGemDependencyInstaller < Gem::TestCase
@aa1, @aa1_gem = util_gem 'aa', '1'
- util_reset_gems
-
FileUtils.mv @a1_gem, @tempdir
FileUtils.mv @aa1_gem, @tempdir
FileUtils.mv @b1_gem, @tempdir
@@ -946,6 +940,31 @@ class TestGemDependencyInstaller < Gem::TestCase
assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
end
+ def test_install_legacy_spec_with_nil_required_ruby_version
+ path = File.expand_path "../data/null-required-ruby-version.gemspec.rz", __FILE__
+ spec = Marshal.load Gem.read_binary(path)
+ def spec.validate(*args); end
+
+ util_build_gem spec
+
+ cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
+ FileUtils.mkdir_p File.dirname cache_file
+ FileUtils.mv spec.cache_file, cache_file
+
+ util_setup_spec_fetcher spec
+
+ data = Gem.read_binary(cache_file)
+
+ @fetcher.data['http://gems.example.com/gems/activesupport-1.0.0.gem'] = data
+
+ dep = Gem::Dependency.new 'activesupport'
+
+ inst = Gem::DependencyInstaller.new
+ inst.install dep
+
+ assert_equal %w[activesupport-1.0.0], Gem::Specification.map(&:full_name)
+ end
+
def test_install_legacy_spec_with_nil_required_rubygems_version
path = File.expand_path "../data/null-required-rubygems-version.gemspec.rz", __FILE__
spec = Marshal.load Gem.read_binary(path)
@@ -1131,16 +1150,6 @@ class TestGemDependencyInstaller < Gem::TestCase
@d1, @d1_gem = util_gem 'd', '1'
@d2, @d2_gem = util_gem 'd', '2'
- util_reset_gems
- end
-
- def util_reset_gems
- @a1 ||= nil
- @b1 ||= nil
- @a1_pre ||= nil
- @d1 ||= nil
- @d2 ||= nil
-
- util_setup_spec_fetcher(*[@a1, @a1_pre, @b1, @d1, @d2].compact)
+ util_setup_spec_fetcher(@d1, @d2)
end
end