You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! I recently ran into the "issue" where doing an expectation like this:
# record = ...
# ^ some active record object
expected_response = {
updated_at: record.updated_at
}
expect(response.body).to include_json expected_response
which raises
NotImplementedError:
2017-11-13 13:37:00 UTC expectation is not supported
the fix here is to use .as_json, like so:
# record = ...
# ^ some active record object
expected_response = {
updated_at: record.updated_at.as_json
}
expect(response.body).to include_json expected_response
For what it's worth, it seems that datetimes are serialized to datetime strings in the Zulu timezone.
I was wondering if you (or others!) would find it useful to automagically detect datetimes like this in the provided expected json, and run as_json on any datetime objects encountered.
The text was updated successfully, but these errors were encountered:
Hey! I recently ran into the "issue" where doing an expectation like this:
which raises
the fix here is to use
.as_json
, like so:For what it's worth, it seems that datetimes are serialized to datetime strings in the Zulu timezone.
I was wondering if you (or others!) would find it useful to automagically detect datetimes like this in the provided expected json, and run
as_json
on any datetime objects encountered.The text was updated successfully, but these errors were encountered: