This patch fixes that assert_routing doesn't behave as expected when +path+ is sent as a hash. assert_routing first calls assert_recognizes, (which can deal with the path as a hash), and then calls assert_generates (which can't).
This patch simply extracts the value :path value (if path is a hash) before sending it as an argument to assert_generates.
path = path[:path] if path.is_a? Hash
assert_generates(path, options, defaults, extras, message)
Includes test (which fails as follows without the patch):
def test_assert_routing_with_path_as_hash
assert_routing({:path => 'content', :method => :get}, :controller => 'content', :action => 'index')
end
1) Failure:
test_assert_routing_with_path_as_hash(TestTest)
[./test/controller/test_test.rb:325:in `test_assert_routing_with_path_as_hash'
/usr/local/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/test_case_adapter.rb:19:in `__send__'
/usr/local/lib/ruby/gems/1.8/gems/mocha-0.4.0/lib/mocha/test_case_adapter.rb:19:in `run']:
The generated path <"/content"> did not match <"/pathcontentmethodget">