summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2016-03-27 00:22:34 -0400
committerAndre Arko <andre@arko.net>2016-03-27 23:12:49 -0700
commit2fc60267bb4e94661e63ca52291a2e74183e7160 (patch)
tree4159a55235b152fc1ec70d36914fc5c623fcd754
parent8897eb95c14e875db9ae17bd0023c5ac19842ed6 (diff)
downloadbundler-2fc60267bb4e94661e63ca52291a2e74183e7160.tar.gz
Allow `bundle outdated` to handle all combinations of `--major`,1-12-backports
`--minor`, and `--patch` flags - Add test coverage for these combination sets - Fixes #4396
-rw-r--r--lib/bundler/cli/outdated.rb8
-rw-r--r--spec/commands/outdated_spec.rb32
2 files changed, 36 insertions, 4 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index 4296ec630d..7928c1f0af 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -126,13 +126,13 @@ module Bundler
update_present = active_major > current_major if options[:major]
- if (options[:minor] || options[:patch]) && current_major == active_major
+ if !update_present && (options[:minor] || options[:patch]) && current_major == active_major
current_minor = current_spec.version.segments[1, 1].first
active_minor = active_spec.version.segments[1, 1].first
- if options[:minor]
- update_present = active_minor > current_minor
- elsif options[:patch] && current_minor == active_minor
+ update_present = active_minor > current_minor if options[:minor]
+
+ if !update_present && options[:patch] && current_minor == active_minor
current_patch = current_spec.version.segments[2, 1].first
active_patch = active_spec.version.segments[2, 1].first
diff --git a/spec/commands/outdated_spec.rb b/spec/commands/outdated_spec.rb
index b77f7cb0dc..7f699f035d 100644
--- a/spec/commands/outdated_spec.rb
+++ b/spec/commands/outdated_spec.rb
@@ -345,4 +345,36 @@ describe "bundle outdated" do
it_behaves_like "major version is ignored"
it_behaves_like "minor version is ignored"
end
+
+ describe "with --minor --patch options" do
+ subject { bundle "outdated --minor --patch" }
+
+ it_behaves_like "minor version updates are detected"
+ it_behaves_like "patch version updates are detected"
+ it_behaves_like "major version is ignored"
+ end
+
+ describe "with --major --minor options" do
+ subject { bundle "outdated --major --minor" }
+
+ it_behaves_like "major version updates are detected"
+ it_behaves_like "minor version updates are detected"
+ it_behaves_like "patch version is ignored"
+ end
+
+ describe "with --major --patch options" do
+ subject { bundle "outdated --major --patch" }
+
+ it_behaves_like "major version updates are detected"
+ it_behaves_like "patch version updates are detected"
+ it_behaves_like "minor version is ignored"
+ end
+
+ describe "with --major --minor --patch options" do
+ subject { bundle "outdated --major --minor --patch" }
+
+ it_behaves_like "major version updates are detected"
+ it_behaves_like "minor version updates are detected"
+ it_behaves_like "patch version updates are detected"
+ end
end