Skip to content

Commit

Permalink
fix #6147 when --parseable and --groups used together
Browse files Browse the repository at this point in the history
  • Loading branch information
markburns committed Dec 18, 2022
1 parent d4d6e7d commit 9c7e6a9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
4 changes: 1 addition & 3 deletions bundler/lib/bundler/cli/outdated.rb
Expand Up @@ -111,9 +111,7 @@ def run
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
Expand Down
46 changes: 46 additions & 0 deletions bundler/spec/bundler/cli_spec.rb
Expand Up @@ -129,6 +129,52 @@ def out_with_macos_man_workaround
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
Expand Down

0 comments on commit 9c7e6a9

Please sign in to comment.