Skip to content

Commit

Permalink
Support match_array matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmire committed Dec 20, 2019
1 parent 691a8ad commit ac35285
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/super_diff/rspec/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,16 @@ def matcher_text_builder_class
end)
end

class MatchArray < ContainExactly
def expected_for_diff
matchers.an_array_matching(expected)
end

def expected_action_for_matcher_text
"match array with"
end
end

class Include
prepend SuperDiff::RSpec::AugmentedMatcher

Expand Down Expand Up @@ -621,5 +631,10 @@ def self.matcher_name
end
end
end

def match_array(items)
BuiltIn::MatchArray.new(items)
end
alias_matcher :an_array_matching, :match_array
end
end
Loading

0 comments on commit ac35285

Please sign in to comment.