diff options
author | Michael Siegfried <michaeldsiegfried@gmail.com> | 2022-12-15 17:33:54 -0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-20 13:15:02 +0900 |
commit | 32e72b78b31a80d308f9762913399d179ed96914 (patch) | |
tree | 4d78ba1f0a7c98b1f775db8699ef1d04bf68e0ae /spec/bundler | |
parent | 42972bdd9259c93c007ecb48987f0b617a5f21e0 (diff) |
[rubygems/rubygems] Add tests for bundle lock
Ensure `bundle lock` handles pre flag just like bundle update does.
https://github.com/rubygems/rubygems/commit/b9e85e3157
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6966
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index ca43591777..431e0c2260 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -176,7 +176,10 @@ RSpec.describe "bundle lock" do build_gem "foo", %w[1.5.1] do |s| s.add_dependency "bar", "~> 3.0" end - build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] + build_gem "foo", %w[2.0.0.pre] do |s| + s.add_dependency "bar" + end + build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 2.1.2.pre 3.0.0 3.1.0.pre 4.0.0.pre] build_gem "qux", %w[1.0.0 1.0.1 1.1.0 2.0.0] end @@ -210,6 +213,32 @@ RSpec.describe "bundle lock" do expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-1.5.0 bar-2.1.1 qux-1.1.0].sort) end + + context "pre" do + it "defaults to major" do + bundle "lock --update --pre" + + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-2.0.0.pre bar-4.0.0.pre qux-2.0.0].sort) + end + + it "patch preferred" do + bundle "lock --update --patch --pre" + + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-1.4.5 bar-2.1.2.pre qux-1.0.1].sort) + end + + it "minor preferred" do + bundle "lock --update --minor --pre" + + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-1.5.1 bar-3.1.0.pre qux-1.1.0].sort) + end + + it "major preferred" do + bundle "lock --update --major --pre" + + expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[foo-2.0.0.pre bar-4.0.0.pre qux-2.0.0].sort) + end + end end it "updates the bundler version in the lockfile without re-resolving", :rubygems => ">= 3.3.0.dev" do |