[rspec-users] how can I get prettier failure messages for integration specs?

David Chelimsky dchelimsky at gmail.com
Thu Apr 19 02:58:26 UTC 2012

On Wednesday, April 18, 2012 at 7:01 PM, Patrick J. Collins wrote:
> When an integration test fails, I get a whole mess of garbage that is
> all in red, very painful to the eyes-- Especially when I quickly just
> want to see what went wrong-- in this case, all I want to see is
> ActiveRecord::RecondNotFound-- but instead I see: 
> Failure/Error: page.should have_content "Submit Payment"
> expected there to be content "Submit Payment" in "Action
> Controller: Exception caught\n body { background-color: #fff; color:
> #333; }\n\n body, p, ol, ul, td {\n font-family: helvetica,
> verdana, arial, sans-serif;\n font-size: 13px;\n
> line-height: 18px;\n }\n\n pre {\n background-color: #eee;\n
> padding: 10px;\n font-size: 11px;\n white-space: pre-wrap;\n
> }\n\n a { color: #000; }\n a:visited { color: #666; }\n a:hover
> { color: #fff; background-color:#000; }\n \n\n\n
> ActiveRecord::RecordNotFound\n ... bla bla bla bla bla bla forever.
> ...... Are there any options to reformat this output? A small
> improvement would be to actually turn \n into actual new lines...
> However, an even better option would be to make this automatically
> launch the browser so that the error page could be read properly.
> Is this possible?
If you're using capybara you could put save_and_open_page in an after hook. You'd still get the console output, but at least you'd see the page in a browser.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120418/d1ae5463/attachment.html>

More information about the rspec-users mailing list