From acb4eddaca739d84ea3b9e4b2186a7eaa99f1b13 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Thu, 7 Nov 2024 09:34:44 -0800 Subject: [PATCH] Allow multiple JSON outputs --- Library/Homebrew/test/cmd/outdated_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/test/cmd/outdated_spec.rb b/Library/Homebrew/test/cmd/outdated_spec.rb index c2af5d43b9aa2..94749286423c0 100644 --- a/Library/Homebrew/test/cmd/outdated_spec.rb +++ b/Library/Homebrew/test/cmd/outdated_spec.rb @@ -20,9 +20,12 @@ }], 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 + .to output(match(/\A(#{Regexp.escape(expected_json)}|#{Regexp.escape(alternate_json)})\n\z/)).to_stdout .and be_a_success end end