My application_helper.rb file:
module ApplicationHelper
def option_text(option_id)
Option.find(option_id).title
end
end
Where do I test this method at? Rails generates helper test files when I create a scaffold, but where do I put a test for this method, since it’s in the Application Helper? I have tried placing the test in one of the view helper test files generated with the scaffold, but it can’t find the method above.
Add a folder under test/unit called ‘helpers’, then create your helper test files like this:
There are some other helpful tips on testing helpers here:
http://technicalpickles.com/posts/helper-testing-using-actionview-testcase/