I would like to write a test for my custom form helper.
Following the instructions from Custom form helpers, I have a form helper like this:
class ActionView::Helpers::FormBuilder
include ActionView::Helpers::TagHelper
include ActionView::Helpers::JavaScriptHelper
def smile_tag(method, options = {})
...
end
end
How would you write a test for smile_tag?
class MyHelperTest < ActionView::TestCase
test "smile_tag" do
...
end
end
Answering to myself…
I’ve found a project on GitHub where the developer creates form helpers and tests them.
https://github.com/dabit/bootstrap-form (it is a gem for Bootstrap Twitter, the project has not seen changes in months).