Reputation: 77
I am upgrading an existing application from Rails 4 to 5.0.0.beta2. It's actually running beautifully!
But, I am running into problems with controller tests. It throws this error:
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
Here is the code (using standard test_helper):
require 'test_helper'
class SeiteControllerTest < ActionController::TestCase
setup do
end
test "should get index" do
#get :index
end
end
Line 14 is the "test should get index" line. Needless to say if I un-comment the "get :index" line, I get the same error.
Upvotes: 1
Views: 801
Reputation: 359
I had what appears to be the same problem. What fixed it for me was to put the following at the end of test_helper.rb
:
class ActionDispatch::IntegrationTest
include Rails::Controller::Testing::TestProcess
include Rails::Controller::Testing::TemplateAssertions
include Rails::Controller::Testing::Integration
end
Upvotes: 0