aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2007-07-19 13:42:11 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2007-07-19 13:42:11 +0000
commit9014bf3f262a6b55aa4a05e2626aeebf688aa05a (patch)
treed7a0bcd785d1a5984e55946a3abe4977d21e37f9 /actionpack/test/controller
parent8b5eb2bacc9e61c6a23b85c03933ef6e2071fab8 (diff)
downloadrails-9014bf3f262a6b55aa4a05e2626aeebf688aa05a.tar.gz
rails-9014bf3f262a6b55aa4a05e2626aeebf688aa05a.tar.bz2
rails-9014bf3f262a6b55aa4a05e2626aeebf688aa05a.zip
* url_for now accepts a series of symbols representing the namespace of the record [Josh Knowles]. Closes #8640
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7197 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/polymorphic_routes_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/controller/polymorphic_routes_test.rb b/actionpack/test/controller/polymorphic_routes_test.rb
index 1dc0502f63..3e72063e9e 100644
--- a/actionpack/test/controller/polymorphic_routes_test.rb
+++ b/actionpack/test/controller/polymorphic_routes_test.rb
@@ -39,6 +39,23 @@ class Test::Unit::TestCase
def article_comment_url(article, comment)
"http://www.example.com/articles/#{article.id}/comments/#{comment.id}"
end
+
+ def admin_articles_url
+ "http://www.example.com/admin/articles"
+ end
+ alias_method :new_admin_article_url, :admin_articles_url
+
+ def admin_article_url(article)
+ "http://www.example.com/admin/articles/#{article.id}"
+ end
+
+ def admin_article_comments_url(article)
+ "http://www.example.com/admin/articles/#{article.id}/comments"
+ end
+
+ def admin_article_comment_url(article, comment)
+ "http://www.example.com/admin/test/articles/#{article.id}/comments/#{comment.id}"
+ end
end
@@ -68,4 +85,14 @@ class PolymorphicRoutesTest < Test::Unit::TestCase
@comment.save
assert_equal(article_comment_url(@article, @comment), polymorphic_url([@article, @comment]))
end
+
+ def test_with_array_and_namespace
+ assert_equal(admin_articles_url, polymorphic_url([:admin, @article], :action => 'new'))
+ assert_equal(admin_articles_url, polymorphic_url([:admin, @article]))
+ @article.save
+ assert_equal(admin_article_url(@article), polymorphic_url([:admin, @article]))
+ assert_equal(admin_article_comments_url(@article), polymorphic_url([:admin, @article, @comment]))
+ @comment.save
+ assert_equal(admin_article_comment_url(@article, @comment), polymorphic_url([:admin, @article, @comment]))
+ end
end