Instead use assert_same_elements from gem shoulda. Details below.
Imagine you have a test like this:
Then, depending on a test environment setup, you might get very different results, sometimes tests like that one will pass, sometimes not.
One way to solve this issue is to use gem 'shoulda' (shoulda-context):
Why not just do assert_same_elements json_response, expected? Because at the moment of writing assert_same_elements is not doing recursive comparison.
No comments:
Post a Comment