diff --git a/Library/Homebrew/test/cmd/info_spec.rb b/Library/Homebrew/test/cmd/info_spec.rb index de636a6e4e..d302dca998 100644 --- a/Library/Homebrew/test/cmd/info_spec.rb +++ b/Library/Homebrew/test/cmd/info_spec.rb @@ -5,6 +5,15 @@ require "cmd/info" require "cmd/shared_examples/args_parse" RSpec.describe "brew info" do + RSpec::Matchers.define :a_json_string do + match do |actual| + JSON.parse(actual) + true + rescue JSON::ParserError + false + end + end + it_behaves_like "parseable arguments" it "prints as json with the --json=v1 flag", :integration_test do diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 141bee02f7..1cf4a428ea 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -304,16 +304,6 @@ end RSpec::Matchers.define_negated_matcher :not_to_output, :output RSpec::Matchers.alias_matcher :have_failed, :be_failed -RSpec::Matchers.alias_matcher :a_string_containing, :include - -RSpec::Matchers.define :a_json_string do - match do |actual| - JSON.parse(actual) - true - rescue JSON::ParserError - false - end -end # Match consecutive elements in an array. RSpec::Matchers.define :array_including_cons do |*cons| diff --git a/Library/Homebrew/test/system_command_result_spec.rb b/Library/Homebrew/test/system_command_result_spec.rb index a985fc9010..d06df27fd8 100644 --- a/Library/Homebrew/test/system_command_result_spec.rb +++ b/Library/Homebrew/test/system_command_result_spec.rb @@ -3,6 +3,8 @@ require "system_command" RSpec.describe SystemCommand::Result do + RSpec::Matchers.alias_matcher :a_string_containing, :include + subject(:result) do described_class.new([], output_array, instance_double(Process::Status, exitstatus: 0, success?: true), secrets: [])