From 0e60b59d5884edb8f9aea023efd9b24f1ff02049 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 8 May 2020 14:19:04 +0900 Subject: Update the bundler version with master branch --- spec/bundler/other/major_deprecation_spec.rb | 22 ++ spec/bundler/other/platform_spec.rb | 553 +++++++++++++-------------- 2 files changed, 278 insertions(+), 297 deletions(-) (limited to 'spec/bundler/other') diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index df2fdd263a..17bf923d84 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -121,6 +121,28 @@ RSpec.describe "major deprecations" do pending "should fail with a helpful error", :bundler => "3" end + context "bundle check --path=" do + before do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G + + bundle "check --path=vendor/bundle" + end + + it "should print a deprecation warning", :bundler => "2" do + expect(deprecations).to include( + "The `--path` flag is deprecated because it relies on being " \ + "remembered across bundler invocations, which bundler will no " \ + "longer do in future versions. Instead please use `bundle config set " \ + "path 'vendor/bundle'`, and stop using this flag" + ) + end + + pending "should fail with a helpful error", :bundler => "3" + end + describe "bundle config" do describe "old list interface" do before do diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb index 7fb4a7404f..4d5be3f784 100644 --- a/spec/bundler/other/platform_spec.rb +++ b/spec/bundler/other/platform_spec.rb @@ -298,20 +298,18 @@ G #{ruby_version_correct} G - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app_lock).to exist end - it "installs fine with any engine" do - simulate_ruby_engine "jruby" do - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + it "installs fine with any engine", :jruby do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - expect(bundled_app("Gemfile.lock")).to exist - end + expect(bundled_app_lock).to exist end it "installs fine when the patchlevel matches" do @@ -322,7 +320,7 @@ G #{ruby_version_correct_patchlevel} G - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app_lock).to exist end it "doesn't install when the ruby version doesn't match" do @@ -333,7 +331,7 @@ G #{ruby_version_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app_lock).not_to exist should_be_ruby_version_incorrect end @@ -345,22 +343,20 @@ G #{engine_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app_lock).not_to exist should_be_engine_incorrect end - it "doesn't install when engine version doesn't match" do - simulate_ruby_engine "jruby" do - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + it "doesn't install when engine version doesn't match", :jruby do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - expect(bundled_app("Gemfile.lock")).not_to exist - should_be_engine_version_incorrect - end + expect(bundled_app_lock).not_to exist + should_be_engine_version_incorrect end it "doesn't install when patchlevel doesn't match" do @@ -371,7 +367,7 @@ G #{patchlevel_incorrect} G - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app_lock).not_to exist should_be_patchlevel_incorrect end end @@ -392,27 +388,25 @@ G bundle :check expect(exitstatus).to eq(0) if exitstatus - expect(out).to eq("Resolving dependencies...\nThe Gemfile's dependencies are satisfied") + expect(out).to match(/\AResolving dependencies\.\.\.\.*\nThe Gemfile's dependencies are satisfied\z/) end - it "checks fine with any engine" do - simulate_ruby_engine "jruby" do - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - G + it "checks fine with any engine", :jruby do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle :check - expect(exitstatus).to eq(0) if exitstatus - expect(out).to eq("Resolving dependencies...\nThe Gemfile's dependencies are satisfied") - end + bundle :check + expect(exitstatus).to eq(0) if exitstatus + expect(out).to match(/\AResolving dependencies\.\.\.\.*\nThe Gemfile's dependencies are satisfied\z/) end it "fails when ruby version doesn't match" do @@ -449,23 +443,21 @@ G should_be_engine_incorrect end - it "fails when engine version doesn't match" do - simulate_ruby_engine "ruby" do - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - G + it "fails when engine version doesn't match", :jruby do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - bundle :check - should_be_engine_version_incorrect - end + bundle :check + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do @@ -513,22 +505,20 @@ G expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end - it "updates fine with any engine" do - simulate_ruby_engine "jruby" do - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "activesupport" - gem "rack-obama" - - #{ruby_version_correct_engineless} - G - update_repo2 do - build_gem "activesupport", "3.0" - end + it "updates fine with any engine", :jruby do + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "activesupport" + gem "rack-obama" - bundle "update", :all => true - expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" + #{ruby_version_correct_engineless} + G + update_repo2 do + build_gem "activesupport", "3.0" end + + bundle "update", :all => true + expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0" end it "fails when ruby version doesn't match" do @@ -547,7 +537,7 @@ G should_be_ruby_version_incorrect end - it "fails when ruby engine doesn't match" do + it "fails when ruby engine doesn't match", :jruby do gemfile <<-G source "#{file_uri_for(gem_repo2)}" gem "activesupport" @@ -563,22 +553,20 @@ G should_be_engine_incorrect end - it "fails when ruby engine version doesn't match" do - simulate_ruby_engine "jruby" do - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "activesupport" - gem "rack-obama" - - #{engine_version_incorrect} - G - update_repo2 do - build_gem "activesupport", "3.0" - end + it "fails when ruby engine version doesn't match", :jruby do + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "activesupport" + gem "rack-obama" - bundle :update, :all => true - should_be_engine_version_incorrect + #{engine_version_incorrect} + G + update_repo2 do + build_gem "activesupport", "3.0" end + + bundle :update, :all => true + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do @@ -617,18 +605,16 @@ G expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end - it "prints path if ruby version is correct for any engine" do - simulate_ruby_engine "jruby" do - install_gemfile! <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rails" + it "prints path if ruby version is correct for any engine", :jruby do + install_gemfile! <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rails" - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle "info rails --path" - expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) - end + bundle "info rails --path" + expect(out).to eq(default_bundle_path("gems", "rails-2.3.2").to_s) end it "fails if ruby version doesn't match", :bundler => "< 3" do @@ -655,18 +641,16 @@ G should_be_engine_incorrect end - it "fails if engine version doesn't match", :bundler => "< 3" do - simulate_ruby_engine "jruby" do - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rails" + it "fails if engine version doesn't match", :bundler => "< 3", :jruby => true do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rails" - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - bundle "show rails" - should_be_engine_version_incorrect - end + bundle "show rails" + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match", :bundler => "< 3" do @@ -704,18 +688,16 @@ G expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end - it "copies the .gem file to vendor/cache when ruby version matches for any engine" do - simulate_ruby_engine "jruby" do - install_gemfile! <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + it "copies the .gem file to vendor/cache when ruby version matches for any engine", :jruby do + install_gemfile! <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'rack' - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle! :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist - end + bundle! :cache + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end it "fails if the ruby version doesn't match" do @@ -740,17 +722,15 @@ G should_be_engine_incorrect end - it "fails if the engine version doesn't match" do - simulate_ruby_engine "jruby" do - gemfile <<-G - gem 'rack' + it "fails if the engine version doesn't match", :jruby do + gemfile <<-G + gem 'rack' - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - bundle :cache - should_be_engine_version_incorrect - end + bundle :cache + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do @@ -785,18 +765,16 @@ G expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end - it "copies the .gem file to vendor/cache when ruby version matches any engine" do - simulate_ruby_engine "jruby" do - install_gemfile! <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' + it "copies the .gem file to vendor/cache when ruby version matches any engine", :jruby do + install_gemfile! <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'rack' - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle :cache - expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist - end + bundle :cache + expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist end it "fails if the ruby version doesn't match" do @@ -821,17 +799,15 @@ G should_be_engine_incorrect end - it "fails if the engine version doesn't match" do - simulate_ruby_engine "jruby" do - gemfile <<-G - gem 'rack' + it "fails if the engine version doesn't match", :jruby do + gemfile <<-G + gem 'rack' - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - bundle :cache - should_be_engine_version_incorrect - end + bundle :cache + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do @@ -850,7 +826,7 @@ G context "bundle exec" do before do ENV["BUNDLER_FORCE_TTY"] = "true" - system_gems "rack-1.0.0", "rack-0.9.1", :path => :bundle_path + system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path end it "activates the correct gem when ruby version matches" do @@ -864,18 +840,16 @@ G expect(out).to include("0.9.1") end - it "activates the correct gem when ruby version matches any engine" do - simulate_ruby_engine "jruby" do - system_gems "rack-1.0.0", "rack-0.9.1", :path => :bundle_path - gemfile <<-G - gem "rack", "0.9.1" + it "activates the correct gem when ruby version matches any engine", :jruby do + system_gems "rack-1.0.0", "rack-0.9.1", :path => default_bundle_path + gemfile <<-G + gem "rack", "0.9.1" - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle "exec rackup" - expect(out).to include("0.9.1") - end + bundle "exec rackup" + expect(out).to include("0.9.1") end it "fails when the ruby version doesn't match" do @@ -900,17 +874,15 @@ G should_be_engine_incorrect end - # it "fails when the engine version doesn't match" do - # simulate_ruby_engine "jruby" do - # gemfile <<-G - # gem "rack", "0.9.1" + # it "fails when the engine version doesn't match", :jruby do + # gemfile <<-G + # gem "rack", "0.9.1" # - # #{engine_version_incorrect} - # G + # #{engine_version_incorrect} + # G # - # bundle "exec rackup" - # should_be_engine_version_incorrect - # end + # bundle "exec rackup" + # should_be_engine_version_incorrect # end it "fails when patchlevel doesn't match" do @@ -936,7 +908,7 @@ G G end - it "starts IRB with the default group loaded when ruby version matches" do + it "starts IRB with the default group loaded when ruby version matches", :readline do gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" @@ -953,24 +925,21 @@ G expect(out).to include("0.9.1") end - it "starts IRB with the default group loaded when ruby version matches any engine" do - skip "MRI cannot simulate JRuby" if RUBY_ENGINE == "ruby" - simulate_ruby_engine "jruby" do - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + it "starts IRB with the default group loaded when ruby version matches", :readline, :jruby do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + gem "activesupport", :group => :test + gem "rack_middleware", :group => :development - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle "console" do |input, _, _| - input.puts("puts RACK") - input.puts("exit") - end - expect(out).to include("0.9.1") + bundle "console" do |input, _, _| + input.puts("puts RACK") + input.puts("exit") end + expect(out).to include("0.9.1") end it "fails when ruby version doesn't match" do @@ -1001,20 +970,18 @@ G should_be_engine_incorrect end - it "fails when engine version doesn't match" do - simulate_ruby_engine "jruby" do - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - gem "activesupport", :group => :test - gem "rack_middleware", :group => :development + it "fails when engine version doesn't match", :jruby do + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + gem "activesupport", :group => :test + gem "rack_middleware", :group => :development - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - bundle "console" - should_be_engine_version_incorrect - end + bundle "console" + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do @@ -1052,27 +1019,25 @@ G #{ruby_version_correct} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app_lock) run "1" - expect(bundled_app("Gemfile.lock")).to exist + expect(bundled_app_lock).to exist end - it "makes a Gemfile.lock if setup succeeds for any engine" do - simulate_ruby_engine "jruby" do - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "yard" - gem "rack" + it "makes a Gemfile.lock if setup succeeds for any engine", :jruby do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "yard" + gem "rack" - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app_lock) - run "1" - expect(bundled_app("Gemfile.lock")).to exist - end + run "1" + expect(bundled_app_lock).to exist end it "fails when ruby version doesn't match" do @@ -1084,13 +1049,11 @@ G #{ruby_version_incorrect} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app_lock) - ruby <<-R - require 'bundler/setup' - R + ruby "require 'bundler/setup'" - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app_lock).not_to exist should_be_ruby_version_incorrect end @@ -1103,35 +1066,29 @@ G #{engine_incorrect} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app_lock) - ruby <<-R - require 'bundler/setup' - R + ruby "require 'bundler/setup'" - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app_lock).not_to exist should_be_engine_incorrect end - it "fails when engine version doesn't match" do - simulate_ruby_engine "jruby" do - install_gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "yard" - gem "rack" + it "fails when engine version doesn't match", :jruby do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "yard" + gem "rack" - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app_lock) - ruby <<-R - require 'bundler/setup' - R + ruby "require 'bundler/setup'" - expect(bundled_app("Gemfile.lock")).not_to exist - should_be_engine_version_incorrect - end + expect(bundled_app_lock).not_to exist + should_be_engine_version_incorrect end it "fails when patchlevel doesn't match" do @@ -1143,13 +1100,11 @@ G #{patchlevel_incorrect} G - FileUtils.rm(bundled_app("Gemfile.lock")) + FileUtils.rm(bundled_app_lock) - ruby <<-R - require 'bundler/setup' - R + ruby "require 'bundler/setup'" - expect(bundled_app("Gemfile.lock")).not_to exist + expect(bundled_app_lock).not_to exist should_be_patchlevel_incorrect end end @@ -1182,30 +1137,40 @@ G G bundle "outdated" - expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5") - expect(out).to include("foo (newest 1.0") + + expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip + Gem Current Latest Requested Groups + activesupport 2.3.5 3.0 = 2.3.5 default + foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default + TABLE + + expect(out).to match(Regexp.new(expected_output)) end - it "returns list of outdated gems when the ruby version matches for any engine" do - simulate_ruby_engine "jruby" do - bundle! :install - update_repo2 do - build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") - end + it "returns list of outdated gems when the ruby version matches for any engine", :jruby do + bundle! :install + update_repo2 do + build_gem "activesupport", "3.0" + update_git "foo", :path => lib_path("foo") + end - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "activesupport", "2.3.5" - gem "foo", :git => "#{lib_path("foo")}" + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "activesupport", "2.3.5" + gem "foo", :git => "#{lib_path("foo")}" - #{ruby_version_correct_engineless} - G + #{ruby_version_correct_engineless} + G - bundle "outdated" - expect(out).to include("activesupport (newest 3.0, installed 2.3.5, requested = 2.3.5)") - expect(out).to include("foo (newest 1.0") - end + bundle "outdated" + + expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip + Gem Current Latest Requested Groups + activesupport 2.3.5 3.0 = 2.3.5 default + foo 1.0 xxxxxxx 1.0 xxxxxxx >= 0 default + TABLE + + expect(out).to match(Regexp.new(expected_output)) end it "fails when the ruby version doesn't match" do @@ -1244,64 +1209,58 @@ G should_be_engine_incorrect end - it "fails when the engine version doesn't match" do - simulate_ruby_engine "jruby" do - update_repo2 do - build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") - end + it "fails when the engine version doesn't match", :jruby do + update_repo2 do + build_gem "activesupport", "3.0" + update_git "foo", :path => lib_path("foo") + end - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "activesupport", "2.3.5" - gem "foo", :git => "#{lib_path("foo")}" + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "activesupport", "2.3.5" + gem "foo", :git => "#{lib_path("foo")}" - #{engine_version_incorrect} - G + #{engine_version_incorrect} + G - bundle "outdated" - should_be_engine_version_incorrect - end + bundle "outdated" + should_be_engine_version_incorrect end - it "fails when the patchlevel doesn't match" do - simulate_ruby_engine "jruby" do - update_repo2 do - build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") - end + it "fails when the patchlevel doesn't match", :jruby do + update_repo2 do + build_gem "activesupport", "3.0" + update_git "foo", :path => lib_path("foo") + end - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "activesupport", "2.3.5" - gem "foo", :git => "#{lib_path("foo")}" + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "activesupport", "2.3.5" + gem "foo", :git => "#{lib_path("foo")}" - #{patchlevel_incorrect} - G + #{patchlevel_incorrect} + G - bundle "outdated" - should_be_patchlevel_incorrect - end + bundle "outdated" + should_be_patchlevel_incorrect end - it "fails when the patchlevel is a fixnum" do - simulate_ruby_engine "jruby" do - update_repo2 do - build_gem "activesupport", "3.0" - update_git "foo", :path => lib_path("foo") - end + it "fails when the patchlevel is a fixnum", :jruby do + update_repo2 do + build_gem "activesupport", "3.0" + update_git "foo", :path => lib_path("foo") + end - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gem "activesupport", "2.3.5" - gem "foo", :git => "#{lib_path("foo")}" + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gem "activesupport", "2.3.5" + gem "foo", :git => "#{lib_path("foo")}" - #{patchlevel_fixnum} - G + #{patchlevel_fixnum} + G - bundle "outdated" - should_be_patchlevel_fixnum - end + bundle "outdated" + should_be_patchlevel_fixnum end end end -- cgit v1.2.3