【发布时间】:2009-06-29 21:49:35
【问题描述】:
似乎 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 中也不例外。而且我的模板很少有部分和布局。没有任何线索,相当调查。
有没有什么秘密插件可以让黄瓜显示完整错误?
【问题讨论】:
-
你的问题标题会是一首好歌曲或电视剧集的标题,但不是一个 SO 问题,所以我修改了它:)
标签: ruby-on-rails testing cucumber integration-testing