我有一个使用灯具的功能测试。我也在我的单元测试中使用灯具,但他们的工作没有缺陷。当运行功能测试,我得到一个:在Rails 3中,我收到了一个NoMethodError的回收!方法测试
NoMethodError: undefined method 'recycle!' for #<Response:0x10346be10> /test/functional/responses_controller_test.rb:10:in 'test_testing'
我功能测试,在这一点上,所做的仅仅是多了去索引操作。例如:
setup do
@response = responses(:one)
end
test "testing" do
get :index
assert true
end
我的TestHelper类确实包括所有的灯具,所以响应灯具肯定是加载。就像我说的,在单元测试中,灯具工作得很好。
任何想法可能会造成这种情况?
谢谢,只是保存了我的培根。与一个名为@request的变量有类似的问题。 – 2011-07-25 21:31:15
哇!与OP有完全相同的代码,现在我的代码与您的解决方案完全相同! @flo – Ben 2014-11-18 05:14:37