aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-08-18 11:50:15 +0100
committerJosé Valim <jose.valim@gmail.com>2010-08-19 15:05:57 -0300
commitc019db8ca1c5639fdae80915cc7520eaad7dcd65 (patch)
treebc1006d0e19e326a7898be207ec9f5b87cf72f90 /actionpack/test/dispatch/routing_test.rb
parent0cc483aa14d79b2d07fdc71dbd935d1af8361d71 (diff)
downloadrails-c019db8ca1c5639fdae80915cc7520eaad7dcd65.tar.gz
rails-c019db8ca1c5639fdae80915cc7520eaad7dcd65.tar.bz2
rails-c019db8ca1c5639fdae80915cc7520eaad7dcd65.zip
Move regexps in options hash to :constraints hash so that they are pushed into the scope [#5208 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 8a1bacce15..fa8447efae 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -379,6 +379,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ namespace :wiki do
+ resources :articles, :id => /[^\/]+/ do
+ resources :comments, :only => [:create, :new]
+ end
+ end
+
scope :only => :show do
namespace :only do
resources :sectors, :only => :index do
@@ -1962,6 +1968,22 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_resource_constraints_are_pushed_to_scope
+ with_test_routes do
+ get '/wiki/articles/Ruby_on_Rails_3.0'
+ assert_equal 'wiki/articles#show', @response.body
+ assert_equal '/wiki/articles/Ruby_on_Rails_3.0', wiki_article_path(:id => 'Ruby_on_Rails_3.0')
+
+ get '/wiki/articles/Ruby_on_Rails_3.0/comments/new'
+ assert_equal 'wiki/comments#new', @response.body
+ assert_equal '/wiki/articles/Ruby_on_Rails_3.0/comments/new', new_wiki_article_comment_path(:article_id => 'Ruby_on_Rails_3.0')
+
+ post '/wiki/articles/Ruby_on_Rails_3.0/comments'
+ assert_equal 'wiki/comments#create', @response.body
+ assert_equal '/wiki/articles/Ruby_on_Rails_3.0/comments', wiki_article_comments_path(:article_id => 'Ruby_on_Rails_3.0')
+ end
+ end
+
private
def with_test_routes
yield