aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJohn Mileham <jmileham@gmail.com>2011-03-24 15:03:08 -0400
committerJohn Mileham <jmileham@gmail.com>2011-03-24 15:03:08 -0400
commitb44a0ec153c84384e9b97a069e81f28bc5c2a4bf (patch)
tree94713aff0c241f91530dfd714bf685019c84ccab /actionpack/test/dispatch/routing_test.rb
parentd5994ee48af14d67f0eec7d23863d4b19211b078 (diff)
parent5214e73850916de3c9127d35a4ecee0424d364a3 (diff)
downloadrails-b44a0ec153c84384e9b97a069e81f28bc5c2a4bf.tar.gz
rails-b44a0ec153c84384e9b97a069e81f28bc5c2a4bf.tar.bz2
rails-b44a0ec153c84384e9b97a069e81f28bc5c2a4bf.zip
Merge branch 'master' of github.com:rails/rails into count_behavior
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb32
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