Patrick J. Collins
2012-Apr-19 00:01 UTC
[rspec-users] how can I get prettier failure messages for integration specs?
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? Patrick J. Collins http://collinatorstudios.com
David Chelimsky
2012-Apr-19 02:58 UTC
[rspec-users] how can I get prettier failure messages for integration specs?
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. HTH, David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120418/d1ae5463/attachment.html>
Patrick J. Collins
2012-Apr-19 04:30 UTC
[rspec-users] how can I get prettier failure messages for integration specs?
On Wed, 18 Apr 2012, David Chelimsky wrote:> 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.Is there a way to make that happen only upon failures during integration tests? Patrick J. Collins http://collinatorstudios.com
David Chelimsky
2012-Apr-19 05:14 UTC
[rspec-users] how can I get prettier failure messages for integration specs?
On Wednesday, April 18, 2012 at 11:30 PM, Patrick J. Collins wrote:> On Wed, 18 Apr 2012, David Chelimsky wrote: > > 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. > > > > > Is there a way to make that happen only upon failures during integration > tests? > >Try this: RSpec.configure do |c| c.after(:each, :type => :request) do save_and_open_page if example.exception end end -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120419/7e9697d7/attachment.html>
Patrick J. Collins
2012-Apr-19 06:00 UTC
[rspec-users] how can I get prettier failure messages for integration specs?
On Thu, 19 Apr 2012, David Chelimsky wrote:> Try this: > > RSpec.configure do |c| > ? c.after(:each, :type => :request) do > ? ? save_and_open_page if example.exception > ? end > end > >Thank you so much! That works perfectly... Patrick J. Collins http://collinatorstudios.com