summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Burns <markburns@users.noreply.github.com>2022-12-18 17:55:53 +0000
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-12-20 13:15:02 +0900
commit870bcc96bab644656cd914b5061fcacc39db6557 (patch)
tree7036bf282ffe72db4e9357e9a178a0855e1235fd
parent8eb66180137e3cba030d43fba21980efa5f58bb3 (diff)
downloadruby-870bcc96bab644656cd914b5061fcacc39db6557.tar.gz
[rubygems/rubygems] fix
https://github.com/rubygems/rubygems/pull/6147 when --parseable and --groups used together https://github.com/rubygems/rubygems/commit/3b0b95c509
-rw-r--r--lib/bundler/cli/outdated.rb4
-rw-r--r--spec/bundler/bundler/cli_spec.rb46
2 files changed, 47 insertions, 3 deletions
diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb
index e9f93fec39..12c3384938 100644
--- a/lib/bundler/cli/outdated.rb
+++ b/lib/bundler/cli/outdated.rb
@@ -111,9 +111,7 @@ module Bundler
end.compact
if options[:parseable]
- relevant_outdated_gems.each do |gems|
- print_gems(gems)
- end
+ print_gems(relevant_outdated_gems)
else
print_gems_table(relevant_outdated_gems)
end
diff --git a/spec/bundler/bundler/cli_spec.rb b/spec/bundler/bundler/cli_spec.rb
index 28ade90138..b752cd7e70 100644
--- a/spec/bundler/bundler/cli_spec.rb
+++ b/spec/bundler/bundler/cli_spec.rb
@@ -129,6 +129,52 @@ RSpec.describe "bundle executable" do
end
end
+ describe "bundle outdated" do
+ let(:run_command) do
+ bundle "install"
+
+ bundle "outdated #{flags}", :raise_on_error => false
+ end
+
+ before do
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack", '0.9.1'
+ G
+ end
+
+ context "with --groups flag" do
+ let(:flags) { "--groups" }
+
+ it "prints a message when there are outdated gems" do
+ run_command
+
+ expect(out).to include("Gem Current Latest Requested Groups")
+ expect(out).to include("rack 0.9.1 1.0.0 = 0.9.1 default")
+ end
+ end
+
+ context "with --parseable" do
+ let(:flags) { "--parseable" }
+
+ it "prints a message when there are outdated gems" do
+ run_command
+
+ expect(out).to include("rack (newest 1.0.0, installed 0.9.1, requested = 0.9.1)")
+ end
+ end
+
+ context "with --groups and --parseable" do
+ let(:flags) { "--groups --parseable" }
+
+ it "prints a simplified message when there are outdated gems" do
+ run_command
+
+ expect(out).to include("rack (newest 1.0.0, installed 0.9.1, requested = 0.9.1)")
+ end
+ end
+ end
+
describe "printing the outdated warning" do
shared_examples_for "no warning" do
it "prints no warning" do