summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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