diff options
-rw-r--r-- | spec/install/bundler_spec.rb | 4 | ||||
-rw-r--r-- | spec/lock/lockfile_bundler_1_spec.rb | 2 | ||||
-rw-r--r-- | spec/lock/lockfile_spec.rb | 2 | ||||
-rw-r--r-- | spec/other/compatibility_guard_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/hax.rb | 8 |
5 files changed, 18 insertions, 4 deletions
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb index fd7d44d664..3c5ae0a84f 100644 --- a/spec/install/bundler_spec.rb +++ b/spec/install/bundler_spec.rb @@ -134,7 +134,7 @@ RSpec.describe "bundle install" do simulate_bundler_version "99999999.99.1" - bundle! "check" + bundle! "check", :env => { "BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD" => "1" } expect(out).to include("The Gemfile's dependencies are satisfied") end @@ -147,7 +147,7 @@ RSpec.describe "bundle install" do simulate_bundler_version "99999999.99.1" - bundle! "check" + bundle! "check", :env => { "BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD" => "1" } expect(out).to include("The Gemfile's dependencies are satisfied") end diff --git a/spec/lock/lockfile_bundler_1_spec.rb b/spec/lock/lockfile_bundler_1_spec.rb index cf283d50fd..1aab5e7750 100644 --- a/spec/lock/lockfile_bundler_1_spec.rb +++ b/spec/lock/lockfile_bundler_1_spec.rb @@ -3,6 +3,8 @@ RSpec.describe "the lockfile format", :bundler => "< 2" do include Bundler::GemHelpers + before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" } + it "generates a simple lockfile for a single source, gem" do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 14cf94bdb7..bcf31d9f2c 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -3,6 +3,8 @@ RSpec.describe "the lockfile format", :bundler => "2" do include Bundler::GemHelpers + before { ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] = "TRUE" } + it "generates a simple lockfile for a single source, gem" do install_gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/other/compatibility_guard_spec.rb b/spec/other/compatibility_guard_spec.rb index 8f458b18e5..ac05ebd918 100644 --- a/spec/other/compatibility_guard_spec.rb +++ b/spec/other/compatibility_guard_spec.rb @@ -4,14 +4,16 @@ RSpec.describe "bundler compatibility guard" do context "when the bundler version is 2+" do before { simulate_bundler_version "2.0.a" } - context "when running on Ruby < 2", :ruby => "< 2.3" do + context "when running on Ruby < 2.3", :ruby => "< 2.3" do + before { simulate_rubygems_version "2.6.11" } + it "raises a friendly error" do bundle :version expect(err).to eq("Bundler 2 requires Ruby 2.3 or later. Either install bundler 1 or update to a supported Ruby version.") end end - context "when running on RubyGems < 2" do + context "when running on RubyGems < 2.5", :ruby => ">= 2.5" do before { simulate_rubygems_version "1.3.6" } it "raises a friendly error" do diff --git a/spec/support/hax.rb b/spec/support/hax.rb index d1cea40922..aee55a0ac9 100644 --- a/spec/support/hax.rb +++ b/spec/support/hax.rb @@ -51,3 +51,11 @@ class Object end end end + +if ENV["BUNDLER_SPEC_IGNORE_COMPATIBILITY_GUARD"] + $LOADED_FEATURES << File.expand_path("../../../bundler/compatibility_guard.rb", __FILE__) + $LOADED_FEATURES << File.expand_path("../../../bundler/compatibility_guard", __FILE__) + $LOADED_FEATURES << "bundler/compatibility_guard.rb" + $LOADED_FEATURES << "bundler/compatibility_guard" + require "bundler/compatibility_guard" +end |