aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-07-20 10:50:38 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2012-07-20 10:50:38 +0100
commitcabb4471afd51968121f6a94b4b161183fc223aa (patch)
treedfcf43aaa1e047c80e56c0a0522cff5aec7a69ba /actionpack/test/dispatch/routing_test.rb
parent27619e34d42183f24c80648ee7a46b7fee348327 (diff)
downloadrails-cabb4471afd51968121f6a94b4b161183fc223aa.tar.gz
rails-cabb4471afd51968121f6a94b4b161183fc223aa.tar.bz2
rails-cabb4471afd51968121f6a94b4b161183fc223aa.zip
Don't assume resource param is :id when using shallow routes
Since #5581 added support for resources with custom params we should not assume that it is :id when using shallow resource routing.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 6c360cc1fc..205238990e 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -487,6 +487,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
resources :messages
end
+ resources :orders do
+ constraints :download => /[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}/ do
+ resources :downloads, :param => :download, :shallow => true
+ end
+ end
+
scope :as => "routes" do
get "/c/:id", :as => :collision, :to => "collision#show"
get "/collision", :to => "collision#show"
@@ -2254,6 +2260,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 404, @response.status
end
+ def test_shallow_custom_param
+ get '/downloads/0c0c0b68-d24b-11e1-a861-001ff3fffe6f.zip'
+ assert_equal 'downloads#show', @response.body
+ assert_equal '0c0c0b68-d24b-11e1-a861-001ff3fffe6f', @request.params[:download]
+ end
+
private
def with_https
old_https = https?