[rubygems/rubygems] Replace lockfile with .locked

https://github.com/rubygems/rubygems/commit/203f3e3802
This commit is contained in:
Tony Hsu 2023-02-27 13:02:23 +01:00 committed by git
parent 556439613a
commit 5f3c7ac196
2 changed files with 32 additions and 1 deletions

View File

@ -47,7 +47,7 @@ m = Module.new do
def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
else "#{gemfile}.lock"
end
File.expand_path(lockfile)

View File

@ -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" }