Search code examples
ruby-on-railsrubytestingrake

Ruby on Rails Test Stopped Working


I was running tests without a problem on a cloud9 console. I made what I thought was a basically inconsequential change in my code to fix a testing fail, and got this error message:

rake aborted! NameError: undefined local variable or method `migrateRails' for main:Object

The change I made was just to add a function to a controller, nothing to do with the test gem. I reinstalled the bundle and ran the test again. Same error.

I undid the change in the controller. Same error.

Thanks.


Solution

  • I think I find my error: when I wrote the test I didn't put "end" at the end of the test.

    I did:

      test "should get contact" do
    get :contact
    assert_response :success
    assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
    

    and I should have done:

      test "should get contact" do
    get :contact
    assert_response :success
    assert_select "title", "Contact | Ruby on Rails Tutorial Sample App"
    end