似乎 cuke 没有显示完整的错误消息(至少在模板中出现问题时),这使得很难找到问题。
这是它在某些错误时输出的内容:
... 我在结帐页面# features/step_definitions/webrat_steps.rb:6 当你没想到时,你有一个 nil 对象! 评估 nil.items 时发生错误 (ActionView::TemplateError) features/manage_orders.feature:9:in `我在结帐页面上' ...
这是在浏览器中重现相同问题时 rails 显示的内容:
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 中也不例外。而且我的模板很少有部分和布局。没有任何线索,相当调查。
是否有任何秘密插件可以让黄瓜显示完整错误?