summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2016-03-27 00:22:34 -0400
committerJames Wen <jrw2175@columbia.edu>2016-03-27 00:22:34 -0400
commit2e39a8e29bb1a61a46078aa74d892a20ba666938 (patch)
treef7fc91eed8ba84418cfd4a93474b4029cffa470d
parent5aa7058df1070b471f174b997a100fa3304cc814 (diff)
downloadbundler-2e39a8e29bb1a61a46078aa74d892a20ba666938.tar.gz
Allow `bundle outdated` to handle all combinations of `--major`,
`--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 111ccadbd3..bd7d1bd520 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