[Rails-core] #3775 - testing helpers which use ActionView methods
Rick Olson
technoweenie at gmail.com
Thu Feb 9 21:09:20 GMT 2006
On 2/9/06, Rick Bradley <rick at rickbradley.com> wrote:
>
> http://dev.rubyonrails.org/ticket/3775
>
> I'm hoping someone will pop up and tell me I'm simply daft with this
> ticket (and queries on IRC, and a prior post to the main Rails list),
> but I can't get a peep out of anyone so far.
>
> The question is, how do I write a simple test for a helper method which
> calls ActionView methods itself. E.g., a foo_link() helper which calls
> link_to(). I noticed that Typo doesn't test these, though it seems to
> have tests for everything else.
>
> Am I missing something, or is there a gap here in Rails' testability?
>
> Best,
> Rick
Check out the ActionView tests. Here's the tag helper tests, for example:
http://dev.rubyonrails.org/browser/trunk/actionpack/test/template/tag_helper_test.rb
The url_for tests require a controller, so you'll see some of them
creating fake controllers with the bare minimum defined.
--
Rick Olson
http://techno-weenie.net
More information about the Rails-core
mailing list