How to make a cucumber error message complete (rails)?

Cuke does not seem to show a complete error message (at least when the problem occurs in the template), which makes it difficult to find the problem.

Here is what it outputs with some error:

 
 ...
     And I am on checkout page # features / step_definitions / webrat_steps.rb: 6
       You have a nil object when you didn't expect it!
       The error occurred while evaluating nil.items (ActionView :: TemplateError)
       features / manage_orders.feature: 9: in `And I am on checkout page '
 ...

And this is what the rails show when the same problem is reproduced in the browser:

Showing app/views/cart/show.erb where line #46 raised: You have a nil object when you didn't expect it! The error occurred while evaluating nil.items Extracted source (around line #46): 43: </script> 44: 45: <% ths = %w{th_title th_price th_subtotal th_quantity}.collect {|th| t th.intern} %> 46: <% table(@cart.items, ths) do |cart_item, style| -%> 47: <tr class="<%= style %>"> 48: <td width="60%"><%=h cart_item.title %></td> 49: <td width="20%"><%=number_to_currency cart_item.price %></td> 

The first one is too neat. No exceptions to the cucumber. And my template has several particulars and a layout. Without any clues, quite an investigation.

Is there any secret plug to get a complete typo?

+6
ruby-on-rails integration-testing testing cucumber
source share
3 answers

The correct answer (thanks to the cuke google group) uses the --backtrace parameter when starting the cucumber.

+8
source share

You can comment on the next line in your /support.env functions to use Rails error handling.

 Cucumber::Rails.bypass_rescue 

You can also use tail -f log / test.log to keep track of logs.

+1
source share

It may not help you very much, but the @cart object does not seem to have been created. Check your controller so that it is.

-one
source share

All Articles