【发布时间】:2016-02-19 03:14:51
【问题描述】:
我正在将现有应用程序从 Rails 4 升级到 5.0.0.beta2。它实际上运行得很漂亮!
但是,我遇到了控制器测试问题。它抛出这个错误:
E
Error:
SeiteControllerTest#test_should_get_index:
NoMethodError: undefined method `each' for nil:NilClass
bin/rails test test/controllers/seite_controller_test.rb:14
Finished in 1.068562s, 0.9358 runs/s, 0.0000 assertions/s.
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
这是代码(使用标准 test_helper):
require 'test_helper'
class SeiteControllerTest < ActionController::TestCase
setup do
end
test "should get index" do
#get :index
end
end
第 14 行是“测试应该获取索引”行。不用说,如果我取消注释“get :index”行,我会得到同样的错误。
【问题讨论】:
-
你能分享
SeiteController的代码吗?
标签: ruby-on-rails ruby testing ruby-on-rails-5