From 4d4d2179f68ecda5736feb6cccd897b73653bce9 Mon Sep 17 00:00:00 2001 From: thedarkone Date: Thu, 28 Jul 2011 20:00:48 +0200 Subject: There is no need to be destructive with the passed-in options. This fixes a bug that is caused by Resource/SingletonResource mangling resource options when using inline "multi"-resource declarations. --- actionpack/test/controller/resources_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test/controller/resources_test.rb') diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 6ea492cf8b..3b1b5fc3ec 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -91,6 +91,15 @@ class ResourcesTest < ActionController::TestCase end end + def test_multiple_resources_with_options + expected_options = {:controller => 'threads', :action => 'index'} + + with_restful_routing :messages, :comments, expected_options.slice(:controller) do + assert_recognizes(expected_options, :path => 'comments') + assert_recognizes(expected_options, :path => 'messages') + end + end + def test_with_custom_conditions with_restful_routing :messages, :conditions => { :subdomain => 'app' } do assert @routes.recognize_path("/messages", :method => :get, :subdomain => 'app') -- cgit v1.2.3 From 41a085ebc9cc7a939c00b058b757b41e106fa44e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 8 Sep 2011 16:02:56 -0700 Subject: Conditions must never be equal --- actionpack/test/controller/resources_test.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'actionpack/test/controller/resources_test.rb') diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 3b1b5fc3ec..b60b30e954 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -1353,11 +1353,6 @@ class ResourcesTest < ActionController::TestCase end def distinct_routes? (r1, r2) - if r1.conditions == r2.conditions and r1.constraints == r2.constraints then - if r1.segments.collect(&:to_s) == r2.segments.collect(&:to_s) then - return false - end - end - true + assert_not_equal r1.conditions, r2.conditions end end -- cgit v1.2.3 From ac1a363c6ed889d11e8fabd6dd69a8a6df9e3cfd Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 8 Sep 2011 16:04:46 -0700 Subject: Pull up a method we only use once. --- actionpack/test/controller/resources_test.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'actionpack/test/controller/resources_test.rb') diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index b60b30e954..b9cd15708b 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -532,7 +532,7 @@ class ResourcesTest < ActionController::TestCase routes.each do |route| routes.each do |r| next if route === r # skip the comparison instance - assert distinct_routes?(route, r), "Duplicate Route: #{route}" + assert_not_equal route.conditions, r.conditions end end end @@ -1351,8 +1351,4 @@ class ResourcesTest < ActionController::TestCase assert_recognizes(expected_options, path) end end - - def distinct_routes? (r1, r2) - assert_not_equal r1.conditions, r2.conditions - end end -- cgit v1.2.3 From a08bee784125d569f63ddd9fa875ae9c5d18b342 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 11 Sep 2011 17:14:29 -0700 Subject: all routes can be stored in the Journey Routes object --- actionpack/test/controller/resources_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/test/controller/resources_test.rb') diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index b9cd15708b..6b8a8f6161 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -532,7 +532,7 @@ class ResourcesTest < ActionController::TestCase routes.each do |route| routes.each do |r| next if route === r # skip the comparison instance - assert_not_equal route.conditions, r.conditions + assert_not_equal [route.conditions, route.path.spec.to_s], [r.conditions, r.path.spec.to_s] end end end -- cgit v1.2.3