jeudi 18 février 2016

Rails 5 testing NoMethodError

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.

Aucun commentaire:

Enregistrer un commentaire