EqJson
RSpec equality matcher that JSON. Outputs meaningful failure messages.
Installation
Add this line to your application's Gemfile:
gem 'eq_json'
And then execute:
$ bundle
Or install it yourself as:
$ gem install eq_json
Usage
require 'eq_json'
actual = {
name: 'Harry Potter and the Sorcerer\'s Stone',
publisherInfo: {
publishDate: {
year: 2015,
month: 3,
day: 23
},
name: "ACME Publisher Inc."
},
author: 'J.K. Rowling'
}
expected = {
name: 'Harry Potter and the Sorcerer\'s Stone',
author: 'J.K. Rowling',
publisherInfo: {
name: "ACME Publisher Inc.",
publishDate: {
month: 3,
day: 23,
year: 2015
}
}
}
expect(expected).to eq_json(actual)
More Documentation
If you don't have keynote here is Quicktime Slide show
Contributing
- Fork it ( https://github.com/[my-github-username]/eq_json/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request