Skip to content

Commit ac35285

Browse files
committed
Support match_array matcher
1 parent 691a8ad commit ac35285

File tree

3 files changed

+398
-0
lines changed

3 files changed

+398
-0
lines changed

lib/super_diff/rspec/monkey_patches.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,16 @@ def matcher_text_builder_class
405405
end)
406406
end
407407

408+
class MatchArray < ContainExactly
409+
def expected_for_diff
410+
matchers.an_array_matching(expected)
411+
end
412+
413+
def expected_action_for_matcher_text
414+
"match array with"
415+
end
416+
end
417+
408418
class Include
409419
prepend SuperDiff::RSpec::AugmentedMatcher
410420

@@ -621,5 +631,10 @@ def self.matcher_name
621631
end
622632
end
623633
end
634+
635+
def match_array(items)
636+
BuiltIn::MatchArray.new(items)
637+
end
638+
alias_matcher :an_array_matching, :match_array
624639
end
625640
end

0 commit comments

Comments
 (0)