Ticket #451 (closed enhancement: duplicate)

Opened 11 months ago

Last modified 10 months ago

Making failing view specs easier to troubleshoot

Reported by: cvonklei..@gmail.com Assigned to:
Priority: medium Milestone: The Future
Component: Merb Keywords:
Cc:

Description

I just had a problem that had me stumped for an hour. All of a sudden all of my view specs were failing, and I couldn't get good troubleshooting information from the rspec output. The output from running rake specs was a bunch of HTML from app/views/exceptions/internal_server_error.html.erb, but there wasn't enough info there to diagnose my problem. It just said "Internal server error" and had no stack trace. (And no, using rake specs --trace wouldn't help in this case.)

The thing that had me absolutely stumped was that the views all worked fine when I ran merb -e test and checked them out with my browser. What could possibly have gone wrong? It turns out that I was using session[] in a before filter in my Application controller, but session[] is undefined when rspec runs.

I finally figured out the problem by making internal_server_error.html.erb show detailed error messages, which is apparently off when running rspec. After I replaced 'if show_details' with 'if true', I finally got a stack trace in the HTML. Even then the output was hard to read, so I wrote the contents of @body to a file and opened that in my browser. That enabled me to see the small problem quickly.

Maybe show_details should be set to true when running rspec, and maybe internal_server_error.html.erb could have a simple <pre> block with error messages and a stack trace inside. The latter would be redundant, but it would aid debugging enormously when reading rspec output in a console.

Attachments

cryptic-output.png (213.7 kB) - added by cvonklei..@gmail.com on 01/13/08 22:30:43.
An example of the hard-to-read output

Change History

01/13/08 22:30:43 changed by cvonklei..@gmail.com

  • attachment cryptic-output.png added.

An example of the hard-to-read output

02/11/08 13:08:22 changed by shayarne..@gmail.com

  • status changed from new to closed.
  • resolution set to duplicate.