diff options
author | chrismo <chrismo@clabs.org> | 2016-06-22 10:10:53 -0500 |
---|---|---|
committer | chrismo <chrismo@clabs.org> | 2016-07-08 19:35:57 -0500 |
commit | 3d1e6e35c85c7d51c4cbd7ca7fd76213b0025655 (patch) | |
tree | d38e102a650961e1459fde511fb3e5a899cbd139 | |
parent | f37c76f1b313fb088cbec19fee3d075b9960a959 (diff) | |
download | bundler-3d1e6e35c85c7d51c4cbd7ca7fd76213b0025655.tar.gz |
Hook-up `--strict` option, flesh out update specs.
Getting caught up on missing update_specs, realized `--strict` flagged
wasn't being passed through. Fixed.
-rw-r--r-- | lib/bundler/cli/update.rb | 5 | ||||
-rw-r--r-- | spec/commands/update_spec.rb | 80 |
2 files changed, 53 insertions, 32 deletions
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index f23d310590..002544ee60 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -40,7 +40,10 @@ module Bundler end patch_level = [:major, :minor, :patch].detect {|v| options.keys.include?(v.to_s) } - Bundler.definition.gem_version_promoter.level = patch_level || :major + Bundler.definition.gem_version_promoter.tap do |gvp| + gvp.level = patch_level || :major + gvp.strict = options[:strict] + end Bundler::Fetcher.disable_endpoint = options["full-index"] diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index cd23c4891d..64d43224e7 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -428,58 +428,76 @@ end # these specs are slow and focus on integration and therefore are not exhaustive. unit specs elsewhere handle that. describe "bundle update conservative" do - context "patch preferred" do - it "single gem without dependencies name specified" do - build_repo4 do - build_gem "foo", %w(1.0.0 1.0.1 1.1.0 2.0.0) + before do + build_repo4 do + build_gem "foo", %w(1.4.3 1.4.4) do |s| + s.add_dependency "bar", "~> 2.0" + end + build_gem "foo", %w(1.4.5 1.5.0) do |s| + s.add_dependency "bar", "~> 2.1" + end + 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 "qux", %w(1.0.0 1.0.1 1.1.0 2.0.0) + end - install_gemfile <<-G - source "file://#{gem_repo4}" - gem 'foo', '1.0.0' - G + # establish a lockfile set to 1.4.3 + install_gemfile <<-G + source "file://#{gem_repo4}" + gem 'foo', '1.4.3' + gem 'bar', '2.0.3' + gem 'qux', '1.0.0' + G - gemfile <<-G - source "file://#{gem_repo4}" - gem 'foo' - G + # remove 1.4.3 requirement and bar altogether + # to setup update specs below + gemfile <<-G + source "file://#{gem_repo4}" + gem 'foo' + gem 'qux' + G + end + context "patch preferred" do + it "single gem updates dependent gem to minor" do bundle "update --patch foo" - should_be_installed "foo 1.0.1" + should_be_installed "foo 1.4.5", "bar 2.1.1", "qux 1.0.0" end - it "single gem without dependencies update all" do - build_repo4 do - build_gem "foo", %w(1.0.0 1.0.1 1.1.0 2.0.0) - end - - install_gemfile <<-G - source "file://#{gem_repo4}" - gem 'foo', '1.0.0' - G - - gemfile <<-G - source "file://#{gem_repo4}" - gem 'foo' - G - + it "update all" do bundle "update --patch" - should_be_installed "foo 1.0.1" + should_be_installed "foo 1.4.5", "bar 2.1.1", "qux 1.0.1" end it "warns on minor or major increment elsewhere" end context "minor preferred" do + it "single gem updates dependent gem to major" do + bundle "update --minor foo" + + should_be_installed "foo 1.5.1", "bar 3.0.0", "qux 1.0.0" + end + it "warns on major increment elsewhere" end context "strict" do - it "patch preferred" + it "patch preferred" do + bundle "update --patch foo bar --strict" - it "minor preferred" + should_be_installed "foo 1.4.4", "bar 2.0.5", "qux 1.0.0" + end + + it "minor preferred" do + bundle "update --minor --strict" + + should_be_installed "foo 1.5.0", "bar 2.1.1", "qux 1.1.0" + end end context "dry run" do |