aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/polymorphic_routes_test.rb
diff options
context:
space:
mode:
authorTarmo Tänav <tarmo@itech.ee>2008-08-21 18:26:05 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-08-21 20:26:00 +0100
commit98fb161dbb13feb18165468aedf1581d5c2305f4 (patch)
tree100a3192923dea387b59ef1b9364d3d940753b33 /actionpack/test/controller/polymorphic_routes_test.rb
parent654c41255d22b2767b943dbe970d8b24f2a1387b (diff)
downloadrails-98fb161dbb13feb18165468aedf1581d5c2305f4.tar.gz
rails-98fb161dbb13feb18165468aedf1581d5c2305f4.tar.bz2
rails-98fb161dbb13feb18165468aedf1581d5c2305f4.zip
Allow polymorphic_url helper to take url options. [#880 state:resolved]
All *_polymorphic_url, *_polymorphic_path helpers can now accept an options hash which will be passed on to the named route making it possible to generate polymorphic routes with additional url parameters. Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/test/controller/polymorphic_routes_test.rb')
-rw-r--r--actionpack/test/controller/polymorphic_routes_test.rb22
1 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb
index 3f52526f08..6ddf2826cd 100644
--- a/actionpack/test/controller/polymorphic_routes_test.rb
+++ b/actionpack/test/controller/polymorphic_routes_test.rb
@@ -60,6 +60,18 @@ uses_mocha 'polymorphic URL helpers' do
edit_polymorphic_url(@article)
end
+ def test_url_helper_prefixed_with_edit_with_url_options
+ @article.save
+ expects(:edit_article_url).with(@article, :param1 => '10')
+ edit_polymorphic_url(@article, :param1 => '10')
+ end
+
+ def test_url_helper_with_url_options
+ @article.save
+ expects(:article_url).with(@article, :param1 => '10')
+ polymorphic_url(@article, :param1 => '10')
+ end
+
def test_formatted_url_helper
expects(:formatted_article_url).with(@article, :pdf)
formatted_polymorphic_url([@article, :pdf])
@@ -67,10 +79,16 @@ uses_mocha 'polymorphic URL helpers' do
def test_format_option
@article.save
- expects(:article_url).with(@article, :pdf)
+ expects(:formatted_article_url).with(@article, :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')
+ polymorphic_url(@article, :format => :pdf, :param1 => '10')
+ end
+
def test_id_and_format_option
@article.save
expects(:article_url).with(:id => @article, :format => :pdf)
@@ -147,7 +165,7 @@ uses_mocha 'polymorphic URL helpers' do
def test_nesting_with_array_containing_singleton_resource_and_format_option
@tag = Tag.new
@tag.save
- expects(:article_response_tag_url).with(@article, @tag, :pdf)
+ expects(:formatted_article_response_tag_url).with(@article, @tag, :pdf)
polymorphic_url([@article, :response, @tag], :format => :pdf)
end