Forum: Ruby on Rails Testing: Application controller and helper

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3afd4d1f4094ece39bbc11e9d38b8b9a?d=identicon&s=25 Shaum Sona (shamarock)
on 2009-04-05 10:14
How do we test application controller and application helper in rails?

Thanks in advance..

-
Shauma.
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-04-05 12:51
(Received via mailing list)
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
This topic is locked and can not be replied to.