mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Move isolated matchers into the specs that uses them
This commit is contained in:
parent
fde7d380f7
commit
914e53e9d5
@ -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
|
||||
|
@ -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|
|
||||
|
@ -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: [])
|
||||
|
Loading…
x
Reference in New Issue
Block a user