diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2025-11-22 20:31:14 -0800 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-11-25 08:09:52 +0000 |
| commit | e920ee32894dcd2ab0f97ff6f45c29d65024da0c (patch) | |
| tree | 32b9c79e4d0c5e54f9933bc3f9eeb07d8d4a106d /spec | |
| parent | 7ba986383cf15f84ce6914b06f8d6b5f26017033 (diff) | |
[ruby/rubygems] Support bundle install --lockfile option
This allows for specifying the lockfile to read and write. It mirrors
the --gemfile option, and has higher priority than the lockfile
method in the Gemfile. It also mirrors the bundle lock --lockfile
option.
When the --lockfile option is used, it is applied twice. First, before
the Gemfile is read, to specify the lockfile to operate on, and again
after the Gemfile is read, so that if the Gemfile has a lockfile
method that overrides the defintion's lockfile, the --lockfile option
still has higher precedence.
https://github.com/ruby/rubygems/commit/17acdd4a89
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/commands/install_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 69d9a86099..bacd8d64f2 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -41,6 +41,17 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app("OmgFile.lock")).to exist end + it "creates lockfile based on --lockfile option is given" do + gemfile bundled_app("OmgFile"), <<-G + source "https://gem.repo1" + gem "myrack", "1.0" + G + + bundle "install --gemfile OmgFile --lockfile ReallyOmgFile.lock" + + expect(bundled_app("ReallyOmgFile.lock")).to exist + end + it "does not make a lockfile if lockfile false is used in Gemfile" do install_gemfile <<-G lockfile false @@ -100,6 +111,18 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app("OmgFile.lock")).not_to exist end + it "doesn't create a lockfile if --no-lock and --lockfile options are given" do + gemfile bundled_app("OmgFile"), <<-G + source "https://gem.repo1" + gem "myrack", "1.0" + G + + bundle "install --gemfile OmgFile --no-lock --lockfile ReallyOmgFile.lock" + + expect(bundled_app("OmgFile.lock")).not_to exist + expect(bundled_app("ReallyOmgFile.lock")).not_to exist + end + it "doesn't delete the lockfile if one already exists" do install_gemfile <<-G source "https://gem.repo1" |
