aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/cli/update.rb5
-rw-r--r--spec/commands/update_spec.rb8
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb
index 002544ee..1c35659e 100644
--- a/lib/bundler/cli/update.rb
+++ b/lib/bundler/cli/update.rb
@@ -39,9 +39,10 @@ module Bundler
Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby])
end
- patch_level = [:major, :minor, :patch].detect {|v| options.keys.include?(v.to_s) }
+ patch_level = [:major, :minor, :patch].select {|v| options.keys.include?(v.to_s) }
+ raise ProductionError, "Provide only one of the following options: #{patch_level.join(", ")}" unless patch_level.length <= 1
Bundler.definition.gem_version_promoter.tap do |gvp|
- gvp.level = patch_level || :major
+ gvp.level = patch_level.first || :major
gvp.strict = options[:strict]
end
diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb
index ce7d2612..90a611dd 100644
--- a/spec/commands/update_spec.rb
+++ b/spec/commands/update_spec.rb
@@ -502,6 +502,14 @@ describe "bundle update conservative" do
end
end
+ context "error handling" do
+ it "raises if too many flags are provided" do
+ bundle "update --patch --minor"
+
+ expect(out).to eq "Provide only one of the following options: minor, patch"
+ end
+ end
+
context "other commands" do
it "Installer could support --dry-run flag for install and update"