README.md in diff_matcher-2.2.0 vs README.md in diff_matcher-2.2.1

- old
+ new

@@ -145,11 +145,11 @@ ``` When `actual` is an array with a *limited* size use an `AllMatcher` to match against *all* the elements in the array adhering to the limits of `:min` -and or `:max`. +and or `:max` or `:size` (where `:size` is a Fixnum or range of Fixnum). ``` ruby puts DiffMatcher::difference(DiffMatcher::AllMatcher.new(Fixnum, :min=>3), [1, 2]) [ : 1, @@ -157,10 +157,19 @@ - Fixnum ] Where, - 1 missing, : 2 match_class ``` +``` ruby +puts DiffMatcher::difference(DiffMatcher::AllMatcher.new(Fixnum, :size=>3..5), [1, 2]) +[ + : 1, + : 2, + - Fixnum +] +Where, - 1 missing, : 2 match_class +``` When `actual` is an array of unknown size *and* `expected` can take multiple forms use a `Matcher` inside of an `AllMatcher` to match against *all* the elements in the array in any of the forms. @@ -244,11 +253,15 @@ ### Object differs * <http://github.com/tinogomes/ssdiff> (Super Stupid Diff) * <http://github.com/postmodern/tdiff> (Calculates the differences between two tree-like structures) * <http://github.com/Blargel/easy_diff> (Recursive diff, merge, and unmerge for hashes and arrays) +### JSON matchers + * <http://github.com/collectiveidea/json_spec> (Easily handle JSON in RSpec and Cucumber) + * <http://github.com/lloyd/JSONSelect> (CSS-like selectors for JSON) + Why another differ? --- This gem came about because [rspec](http://github.com/rspec/rspec-expectations) doesn't have a decent differ for matching hashes and/or JSON. It started out as a [pull request](http://github.com/rspec/rspec-expectations/pull/79), to be implemented as a @@ -259,9 +272,11 @@ It has extra functionality in also being able to recursively merge hashes and arrays. [sub_diff](http://github.com/shuber/sub_diff) can use regular expressions in its match and subsequent diff DiffMatcher can match using not only regexes but classes and procs. And the difference string that it outputs can be formatted in several ways as needed. + +As for matching JSON, the matchers above work well, but don't allow for matching patterns. Use with rspec --- To use with rspec create the following custom matcher: