diff options
author | Volmer <git@radicaos.com> | 2016-07-04 21:58:20 -0400 |
---|---|---|
committer | Volmer <git@radicaos.com> | 2016-07-05 11:16:54 -0400 |
commit | 1fd9cdfda6c4e4473667cb6e28b8097607abc765 (patch) | |
tree | f4446bccd23db8232bf248e6f3c3a75a9b8d856c /actionpack/test | |
parent | 9552f8b457a674c66f99d6cbef244fbb7de6ba34 (diff) | |
download | rails-1fd9cdfda6c4e4473667cb6e28b8097607abc765.tar.gz rails-1fd9cdfda6c4e4473667cb6e28b8097607abc765.tar.bz2 rails-1fd9cdfda6c4e4473667cb6e28b8097607abc765.zip |
Deprecate usage of nil as route path
In Rails 4 these kind of routes used to work:
```ruby
scope '/*id', controller: :builds, as: :build do
get action: :show
end
```
But since 1a830cbd830c7f80936dff7e3c8b26f60dcc371d, routes are only created for
paths specified as strings or symbols. Implicit `nil` paths are just ignored,
with no deprecation warnings or errors. Routes are simply not created. This come
as a surprise for people migrating to Rails 5, since the lack of logs or errors
makes hard to understand where the problem is.
This commit introduces a deprecation warning in case of path as `nil`, while
still allowing the route definition.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 75fdc9469f..d54cdf7247 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -373,6 +373,9 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest post "create", :as => "" put "update" get "remove", :action => :destroy, :as => :remove + tc.assert_deprecated do + get action: :show, as: :show + end end end @@ -391,6 +394,10 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest get '/pagemark/remove' assert_equal 'pagemarks#destroy', @response.body assert_equal '/pagemark/remove', pagemark_remove_path + + get '/pagemark' + assert_equal 'pagemarks#show', @response.body + assert_equal '/pagemark', pagemark_show_path end def test_admin |