summaryrefslogtreecommitdiff
path: root/spec/commands/binstubs_spec.rb
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-07-29 07:57:34 +0000
committerBundlerbot <bot@bundler.io>2019-07-29 07:57:34 +0000
commit3af2211195811e1e0618c166387a53a677ab1438 (patch)
tree21f542509f21695c0ade5ffdfc39d8a69b7dbc31 /spec/commands/binstubs_spec.rb
parentcdd2075c71e2426e6fd77c1a340620753b14669e (diff)
parentcaf13e9e4fb2455199741dd81117f580f894af67 (diff)
downloadbundler-3af2211195811e1e0618c166387a53a677ab1438.tar.gz
Merge #7259
7259: Relax bundler binstub r=indirect a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that the logic to select bundler versions was different when bundler is run from a rubygems binstub that when bundler is run from a bundler binstub. ### What was your diagnosis of the problem? My diagnosis was that we should unify the logic. ### What is your fix for the problem, implemented in this PR? My fix is to use the same logic implemented in the rubygems version finder, namely, only fail if the major version of bundler does not match. ### Why did you choose this fix out of the possible options? I chose this fix because it makes things consistent. Fixes #7243. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'spec/commands/binstubs_spec.rb')
-rw-r--r--spec/commands/binstubs_spec.rb34
1 files changed, 21 insertions, 13 deletions
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index f3e8233570..748cf6362f 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -135,8 +135,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "runs the correct version of bundler" do
sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999"
expect(exitstatus).to eq(42) if exitstatus
- expect(err).to include("Activating bundler (999.999.999) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
+ expect(err).to include("Activating bundler (~> 999.999) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end
end
@@ -145,17 +145,25 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "999.999.999")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(err).to include("Activating bundler (999.999.999) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
+ expect(err).to include("Activating bundler (~> 999.999) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end
- it "runs the correct version of bundler when the version is older" do
+ it "runs the correct version of bundler when the version is older and a different major" do
simulate_bundler_version "55"
lockfile lockfile.gsub(system_bundler_version, "44.0")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(err).to include("Activating bundler (44.0) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '44.0'`")
+ expect(err).to include("Activating bundler (~> 44.0) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`")
+ end
+
+ it "runs the available version of bundler when the version is older and the same major" do
+ simulate_bundler_version "55.1"
+ lockfile lockfile.gsub(system_bundler_version, "55.0")
+ sys_exec "#{bundled_app("bin/bundle")} install"
+ expect(exitstatus).not_to eq(42) if exitstatus
+ expect(err).not_to include("Activating bundler (~> 55.0) failed:")
end
it "runs the correct version of bundler when the version is a pre-release" do
@@ -163,8 +171,8 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "2.12.0.a")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(err).to include("Activating bundler (2.12.0.a) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '2.12.0.a'`")
+ expect(err).to include("Activating bundler (~> 2.12.a) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`")
end
end
@@ -179,8 +187,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "calls through to the explicit bundler version" do
sys_exec "#{bundled_app("bin/bundle")} update --bundler=999.999.999"
expect(exitstatus).to eq(42) if exitstatus
- expect(err).to include("Activating bundler (999.999.999) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
+ expect(err).to include("Activating bundler (~> 999.999) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end
end
@@ -205,8 +213,8 @@ RSpec.describe "bundle binstubs <gem>" do
it "attempts to load that version" do
sys_exec bundled_app("bin/rackup").to_s
expect(exitstatus).to eq(42) if exitstatus
- expect(err).to include("Activating bundler (999.999.999) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
+ expect(err).to include("Activating bundler (~> 999.999) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`")
end
end
end