summaryrefslogtreecommitdiff
path: root/spec/bundler/runtime
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-12-08 16:36:29 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-12-08 17:30:02 +0900
commit473f9d2df0ddd7fdb5cc73fa3ad49b2f19f22b06 (patch)
tree6b39312502d32474da0157f5d55620fabd6454ea /spec/bundler/runtime
parent4aca77edde91f826aa243e268bf1ef5214530583 (diff)
Merge prepare version of Bundler 2.2.0
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3864
Diffstat (limited to 'spec/bundler/runtime')
-rw-r--r--spec/bundler/runtime/inline_spec.rb30
-rw-r--r--spec/bundler/runtime/setup_spec.rb5
2 files changed, 34 insertions, 1 deletions
diff --git a/spec/bundler/runtime/inline_spec.rb b/spec/bundler/runtime/inline_spec.rb
index 1ba50c0e97..fadf3eb989 100644
--- a/spec/bundler/runtime/inline_spec.rb
+++ b/spec/bundler/runtime/inline_spec.rb
@@ -369,4 +369,34 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to eq("WIN")
expect(err).to be_empty
end
+
+ it "when requiring fileutils after does not show redefinition warnings" do
+ dependency_installer_loads_fileutils = ruby "require 'rubygems/dependency_installer'; puts $LOADED_FEATURES.grep(/fileutils/)", :raise_on_error => false
+ skip "does not work if rubygems/dependency_installer loads fileutils, which happens until rubygems 3.2.0" unless dependency_installer_loads_fileutils.empty?
+
+ skip "does not work on ruby 3.0 because it changes the path to look for default gems, tsort is a default gem there, and we can't install it either like we do with fiddle because it doesn't yet exist" unless RUBY_VERSION < "3.0.0"
+
+ Dir.mkdir tmp("path_without_gemfile")
+
+ default_fileutils_version = ruby "gem 'fileutils', '< 999999'; require 'fileutils'; puts FileUtils::VERSION", :raise_on_error => false
+ skip "fileutils isn't a default gem" if default_fileutils_version.empty?
+
+ realworld_system_gems "fileutils --version 1.4.1"
+
+ realworld_system_gems "fiddle" # not sure why, but this is needed on Windows to boot rubygems succesfully
+
+ realworld_system_gems "timeout uri" # this spec uses net/http which requires these default gems
+
+ script <<-RUBY, :dir => tmp("path_without_gemfile"), :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s }
+ require "bundler/inline"
+
+ gemfile(true) do
+ source "#{file_uri_for(gem_repo2)}"
+ end
+
+ require "fileutils"
+ RUBY
+
+ expect(err).to eq("The Gemfile specifies no dependencies")
+ end
end
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index 8424e02de1..6b47878944 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -1233,6 +1233,9 @@ end
end << "bundler"
exempts << "fiddle" if Gem.win_platform? && Gem::Version.new(Gem::VERSION) >= Gem::Version.new("2.7")
exempts << "uri" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7")
+ exempts << "pathname" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
+ exempts << "set" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
+ exempts << "tsort" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0")
exempts
end
@@ -1313,7 +1316,7 @@ end
expect(out).to eq("The Gemfile's dependencies are satisfied")
end
- # bundler respects paths specified directly in RUBYLIB or RUBYOPT, and
+ # bundler respects paths specified direclty in RUBYLIB or RUBYOPT, and
# that happens when running ruby from the ruby-core setup. To
# workaround, we manually remove those for these tests when they would
# override the default gem.