2009-06-29 53 views
6

看起来像cuke并没有显示完整的错误信息(至少在模板出现问题时),这使得很难找到问题。如何使黄瓜显示完整(导轨)的错误信息?

下面是它输出的一些错误:

 
... 
    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' 
... 

这里是当同样的问题在浏览器中复制什么轨显示:

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> 

前者是有点太整齐。 cucumber.log也没有例外。而且我的模板没有几个部分和一个布局。没有线索,很有调查。

是否有任何秘密插件拉黄瓜显示完整的错误?

+0

你的问题标题会制作出好的歌曲或电视连续剧集标题,但不是一个SO问题,所以我改变了它:) – karim79 2009-06-29 21:53:38

回答

8

正确答案(感谢cuke google组)在运行黄瓜时使用--backtrace选项。

-1

也许帮助不大,但@cart对象似乎没有被实例化。检查你的控制器,以便它。

+1

问题不在于错误本身,而是cuke无用的事实报告细节。 – artemave 2009-06-29 22:21:26

1

您可以在您的features/support.env中的以下行注释以使用Rails错误处理。

Cucumber::Rails.bypass_rescue 

您还可以使用tail -f log/test.log来关注日志。