Pattern: Use of match_array
Issue: -
Checks where match_array
is used.
This rule checks for the following:
- Prefer
contain_exactly
when matching an array with values. - Prefer
eq
when usingmatch_array
with an empty array literal.
# bad
it { is_expected.to match_array([content1, content2]) }
# good
it { is_expected.to contain_exactly(content1, content2) }
# good
it { is_expected.to match_array([content] + array) }
# good
it { is_expected.to match_array(%w(tremble in fear foolish mortals)) }