Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit comparison of complete objects #106

Closed
yovasx2 opened this issue May 27, 2016 · 2 comments
Closed

Permit comparison of complete objects #106

yovasx2 opened this issue May 27, 2016 · 2 comments

Comments

@yovasx2
Copy link

yovasx2 commented May 27, 2016

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 )
@yovasx2 yovasx2 changed the title Permit comparisonnof complete objects Permit comparison of complete objects May 27, 2016
@sethpollack
Copy link
Collaborator

This is not something that we plan to support right now. You can always just convert your object to a hash.

@sethpollack
Copy link
Collaborator

Also you don't need a separate test for each property:

expect_json('data.restaurant', id: restaurant.id, name: restaurant.name )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants