Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Change the Default Controller Name in Rails Functional Tests


Rails will infer the controller you want to test from the class name of the test case. For example...

class PeopleControllerTest < ActionController::TestCase

will test the app/controllers/people_controller.rb.

To change this is trivial. Use the "test" method inside your test case.

class PeopleControllerImportContactsFromGmailTest < ActionController::TestCase
     tests PeopleController

You might want to do this to separate actions in your controller by file in your test suite.

Tagged w/ #rails #ruby on rails #testing #functional tests #configuration