when you inherit ActionController :: TestCase, it indicates the name of the controller from the name of the test, if they do not match, you must use the setup part of the test to install it.
So if you have
class PostsControllerTest < ActionController::TestCase def test_index
Then @controller automatically created on PostsController , however, if it is not, and you had a different name, you will need setup as such
class SomeTest < ActionController::TestCase def setup @controller = PostController.new end end
ErsatzRyan Oct 12 '11 at 16:15 2011-10-12 16:15
source share