Permit comparison of complete objects
yovasx2 opened this issue · 2 comments
yovasx2 commented
Instead of test element by element value. You can be able to compare the complete object:
Suppose you have next JSON
{"data":` "restaurant": { "id": 1, "name": "Number 1", ... } }
An an object restaurant typre Restaurant, so istead of doing:
expect_json('data.restaurant', id: restaurant.id )
expect_json('data.restaurant', name: restaurant.name )
...
You have the possibility to do:
expect_json('data', restaurant: restaurant )
sethpollack commented
This is not something that we plan to support right now. You can always just convert your object to a hash.
sethpollack commented
Also you don't need a separate test for each property:
expect_json('data.restaurant', id: restaurant.id, name: restaurant.name )