summaryrefslogtreecommitdiff
path: root/spec/bundler
diff options
context:
space:
mode:
authorTony Hsu <tonyc.t.hsu@gmail.com>2023-02-27 13:02:23 +0100
committergit <svn-admin@ruby-lang.org>2023-03-02 14:43:27 +0000
commit5f3c7ac19674b822c72e09e40cfb58fc71ac501e (patch)
tree46c4fda0ad655ba0f7126d834cc15760b509ec8b /spec/bundler
parent556439613aa6a0d05a9884a305ae43f48cd2c5f0 (diff)
downloadruby-5f3c7ac19674b822c72e09e40cfb58fc71ac501e.tar.gz
[rubygems/rubygems] Replace lockfile with `.locked`
https://github.com/rubygems/rubygems/commit/203f3e3802
Diffstat (limited to 'spec/bundler')
-rw-r--r--spec/bundler/commands/binstubs_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb
index 72f4cc8e55..bfbef58181 100644
--- a/spec/bundler/commands/binstubs_spec.rb
+++ b/spec/bundler/commands/binstubs_spec.rb
@@ -166,6 +166,21 @@ RSpec.describe "bundle binstubs <gem>" do
end
end
+ context "and the version is newer when given `gems.rb` and `gems.locked`" do
+ before do
+ gemfile bundled_app("gems.rb"), gemfile
+ lockfile bundled_app("gems.locked"), lockfile.gsub(system_bundler_version, "999.999")
+ end
+
+ it "runs the correct version of bundler" do
+ sys_exec "bin/bundle install", :env => { "BUNDLE_GEMFILE" => "gems.rb" }, :raise_on_error => false
+
+ expect(exitstatus).to eq(42)
+ 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
+
context "and the version is older and a different major" do
let(:system_bundler_version) { "55" }
@@ -181,6 +196,22 @@ RSpec.describe "bundle binstubs <gem>" do
end
end
+ context "and the version is older and a different major when given `gems.rb` and `gems.locked`" do
+ let(:system_bundler_version) { "55" }
+
+ before do
+ gemfile bundled_app("gems.rb"), gemfile
+ lockfile bundled_app("gems.locked"), lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 44.0")
+ end
+
+ it "runs the correct version of bundler" do
+ sys_exec "bin/bundle install", :env => { "BUNDLE_GEMFILE" => "gems.rb" }, :raise_on_error => false
+ expect(exitstatus).to eq(42)
+ 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
+ end
+
context "and the version is older and the same major" do
let(:system_bundler_version) { "2.999.999" }