From c82e8e1f483ece1fbd2e9f73715fd211487620fc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 7 Nov 2008 15:42:34 -0500 Subject: Move controller assertions from base TestCase to AC:: and AV::TestCase --- actionpack/test/controller/polymorphic_routes_test.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'actionpack/test/controller/polymorphic_routes_test.rb') diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb index 6ddf2826cd..df49a37f89 100644 --- a/actionpack/test/controller/polymorphic_routes_test.rb +++ b/actionpack/test/controller/polymorphic_routes_test.rb @@ -22,8 +22,7 @@ end class Response::Nested < Response; end uses_mocha 'polymorphic URL helpers' do - class PolymorphicRoutesTest < Test::Unit::TestCase - + class PolymorphicRoutesTest < ActiveSupport::TestCase include ActionController::PolymorphicRoutes def setup -- cgit v1.2.3 From 94d6716324126028b89dde886f160474049b1b0c Mon Sep 17 00:00:00 2001 From: hiroshi Date: Mon, 3 Nov 2008 14:09:07 +0900 Subject: Make polymorphic_url compact given array [#1317 state:committed] Signed-off-by: David Heinemeier Hansson --- actionpack/test/controller/polymorphic_routes_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test/controller/polymorphic_routes_test.rb') diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb index 6ddf2826cd..620f2b3ab5 100644 --- a/actionpack/test/controller/polymorphic_routes_test.rb +++ b/actionpack/test/controller/polymorphic_routes_test.rb @@ -169,6 +169,17 @@ uses_mocha 'polymorphic URL helpers' do polymorphic_url([@article, :response, @tag], :format => :pdf) end + def test_nesting_with_array_containing_nil + expects(:article_response_url).with(@article) + polymorphic_url([@article, nil, :response]) + end + + def test_with_array_containing_single_object + @article.save + expects(:article_url).with(@article) + polymorphic_url([nil, @article]) + end + # TODO: Needs to be updated to correctly know about whether the object is in a hash or not def xtest_with_hash expects(:article_url).with(@article) -- cgit v1.2.3 From 291d199de1271c254c44b94766d13013b222a125 Mon Sep 17 00:00:00 2001 From: Hiroshi Saito Date: Sun, 16 Nov 2008 17:51:39 +0900 Subject: Let polymorphic_path treat an array contains single name as without array [#1386 state:committed] Signed-off-by: David Heinemeier Hansson --- actionpack/test/controller/polymorphic_routes_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'actionpack/test/controller/polymorphic_routes_test.rb') diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb index efa3c44bc0..42dbea3b8f 100644 --- a/actionpack/test/controller/polymorphic_routes_test.rb +++ b/actionpack/test/controller/polymorphic_routes_test.rb @@ -179,6 +179,12 @@ uses_mocha 'polymorphic URL helpers' do polymorphic_url([nil, @article]) end + def test_with_array_containing_single_name + @article.save + expects(:articles_url) + polymorphic_url([:articles]) + end + # TODO: Needs to be updated to correctly know about whether the object is in a hash or not def xtest_with_hash expects(:article_url).with(@article) -- cgit v1.2.3 From 93456a2ed275575a03bd2d6234095395dee6a655 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 30 Nov 2008 17:03:38 -0800 Subject: Deprecated formatted_polymorphic_url --- actionpack/test/controller/polymorphic_routes_test.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'actionpack/test/controller/polymorphic_routes_test.rb') diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb index 42dbea3b8f..09c7f74617 100644 --- a/actionpack/test/controller/polymorphic_routes_test.rb +++ b/actionpack/test/controller/polymorphic_routes_test.rb @@ -71,20 +71,22 @@ uses_mocha 'polymorphic URL helpers' do polymorphic_url(@article, :param1 => '10') end - def test_formatted_url_helper - expects(:formatted_article_url).with(@article, :pdf) - formatted_polymorphic_url([@article, :pdf]) + def test_formatted_url_helper_is_deprecated + expects(:articles_url).with(:format => :pdf) + assert_deprecated do + formatted_polymorphic_url([@article, :pdf]) + end end def test_format_option @article.save - expects(:formatted_article_url).with(@article, :pdf) + expects(:article_url).with(@article, :format => :pdf) polymorphic_url(@article, :format => :pdf) end def test_format_option_with_url_options @article.save - expects(:formatted_article_url).with(@article, :pdf, :param1 => '10') + expects(:article_url).with(@article, :format => :pdf, :param1 => '10') polymorphic_url(@article, :format => :pdf, :param1 => '10') end @@ -157,14 +159,14 @@ uses_mocha 'polymorphic URL helpers' do def test_nesting_with_array_containing_singleton_resource_and_format @tag = Tag.new @tag.save - expects(:formatted_article_response_tag_url).with(@article, @tag, :pdf) - formatted_polymorphic_url([@article, :response, @tag, :pdf]) + expects(:article_response_tag_url).with(@article, @tag, :format => :pdf) + polymorphic_url([@article, :response, @tag], :format => :pdf) end def test_nesting_with_array_containing_singleton_resource_and_format_option @tag = Tag.new @tag.save - expects(:formatted_article_response_tag_url).with(@article, @tag, :pdf) + expects(:article_response_tag_url).with(@article, @tag, :format => :pdf) polymorphic_url([@article, :response, @tag], :format => :pdf) end -- cgit v1.2.3