Change command output instead
This commit is contained in:
parent
acb4eddaca
commit
ebe1e504da
@ -65,7 +65,9 @@ module Homebrew
|
||||
formulae: json_info(formulae),
|
||||
casks: json_info(casks),
|
||||
}
|
||||
puts JSON.pretty_generate(json)
|
||||
# json v2.8.1 is inconsistent it how it renders empty arrays,
|
||||
# so we use `[]` for consistency:
|
||||
puts JSON.pretty_generate(json).gsub(/\[\n\n\s*\]/, "[]")
|
||||
|
||||
outdated = formulae + casks
|
||||
else
|
||||
|
||||
@ -20,12 +20,9 @@ RSpec.describe Homebrew::Cmd::Outdated do
|
||||
}],
|
||||
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(match(/\A(#{Regexp.escape(expected_json)}|#{Regexp.escape(alternate_json)})\n\z/)).to_stdout
|
||||
.to output("#{expected_json}\n").to_stdout
|
||||
.and be_a_success
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user