Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bundle outdated with both --groups and --parseable flags #6148

Merged
merged 1 commit into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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