How do we test application controller and application helper in rails? Thanks in advance.. - Shauma.
on 2009-04-05 10:14
on 2009-04-05 12:51
Shaum Sona wrote: > How do we test application controller and application helper in rails? Two answers. The best answer is you should use Test-Driven Development, where you write a test that fails because a minor ability of a feature is not there, and you get the test to fail for the correct reason. Then you write a little code to provide the ability and pass the test. The great thing about TDD is you are not required to make sure the test actually calls the exact method that provides the ability. Sometimes that's a good goal, yet TDD provides such comprehensive test coverage that the ideal of "unit" testing becomes less important. You TDD the application controller and helper by firing up the usual functional tests on your usual controllers and views, and TDDing their features. The second answer: El Goog would have lead you to "rails helper tests": http://nubyonrails.com/articles/test-your-helpers The third answer is I don't see why a functional test cannot simply reach out to ApplicationController alone... -- Phlip