diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2011-03-06 07:08:50 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2011-03-06 07:08:50 +0000 |
commit | e00867bc437b6a681491ef59e13423051e6d98f0 (patch) | |
tree | 75e82e12162d49368d007f723a1a39dcfe5fe5c3 /actionpack/test/dispatch | |
parent | 0509bf35f1987c1e0b9c3dd1389778f8426180f7 (diff) | |
download | rails-e00867bc437b6a681491ef59e13423051e6d98f0.tar.gz rails-e00867bc437b6a681491ef59e13423051e6d98f0.tar.bz2 rails-e00867bc437b6a681491ef59e13423051e6d98f0.zip |
Raise ArgumentError if route name is invalid [#6517 state:resolved]
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 1a96587836..5e5758a60e 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -2313,6 +2313,38 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_invalid_route_name_raises_error + assert_raise(ArgumentError) do + self.class.stub_controllers do |routes| + routes.draw { get '/products', :to => 'products#index', :as => 'products ' } + end + end + + assert_raise(ArgumentError) do + self.class.stub_controllers do |routes| + routes.draw { get '/products', :to => 'products#index', :as => ' products' } + end + end + + assert_raise(ArgumentError) do + self.class.stub_controllers do |routes| + routes.draw { get '/products', :to => 'products#index', :as => 'products!' } + end + end + + assert_raise(ArgumentError) do + self.class.stub_controllers do |routes| + routes.draw { get '/products', :to => 'products#index', :as => 'products index' } + end + end + + assert_raise(ArgumentError) do + self.class.stub_controllers do |routes| + routes.draw { get '/products', :to => 'products#index', :as => '1products' } + end + end + end + def test_nested_route_in_nested_resource get "/posts/1/comments/2/views" assert_equal "comments#views", @response.body |