In testing my helpers, I discovered a nil.rewrite exception due to ActionController::Base.initialize_current_url not being called. This occurs when using url_for with a hash as arguments.
ActionView::TestCase does not initialize current url so you won't be able to use *_url and *_path helpers generated from your routes. Put the following lines at the end of your test_helper.rb file to resolve the issue.
class ActionView::TestCase < ActiveSupport::TestCase
class TestController < ActionController::Base
attr_accessor :request, :response, :params
def initialize
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
#TestCase doesn't have context of a current url so cheat a bit
@params = {}
send(:initialize_current_url)
end
end
end
I've submitted a patch to core regarding this. Please +1 for the good of helper_tests!