Debug failing test with assert_dom_equal
If you are using assert_select, which you should be, you might get into situations where you are unsure why it is failing, and its output isn’t always illuminating for that. You can do a quick sanity check by doing a
assert_dom_equal('foo', @response.body)
right before the failing tests and you’ll get the full response body for the test dumped to your console.
It’s useful for discovering things like the fact that you forgot the = in <%= yield %> in your test layout.

Articles via rss or email