Skip to content

Commit

Permalink
Allow multiple JSON outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Nov 7, 2024
1 parent c17ffb8 commit 9246301
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Library/Homebrew/test/cmd/outdated_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RSpec.describe Homebrew::Cmd::Outdated do
it_behaves_like "parseable arguments"

it "outputs JSON", :integration_test do
it "outputs JSON", :integration_test, :skip_generic do
setup_test_formula "testball"
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath

Expand All @@ -20,9 +20,13 @@
}],
casks: [],
})
# json v2.8.1 is inconsistent it how it renders empty arrays,
# for now we allow multiple outputs:
alternate_json = expected_json.gsub("[]", "[\n\n]")

expect { brew "outdated", "--json=v2" }
.to output("#{expected_json}\n").to_stdout
.and be_a_success
.to(output("#{expected_json}\n").to_stdout
.or(output("#{alternate_json}\n").to_stdout)
.and(be_a_success))
end
end

0 comments on commit 9246301

Please sign in to comment.