I recently wrote a functional test for an AJAX callback action. I wanted to assert that the RJS replaced some text with a particular string. This string is generated by a view helper. To keep this flexibility, I wanted to call the helper from the test.

It turns out to be quite simple. All you have to do is mix-in the helper to your TestCase class, like so:

class CompanyControllerTest < Test::Rails::TestCase
  include CompanyHelper
...
end

Leave a Reply