aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_helper_test.rb
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/template/form_helper_test.rb
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/template/form_helper_test.rb')
-rw-r--r--actionpack/test/template/form_helper_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index bec754f844..a852f2af17 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -629,6 +629,25 @@ class FormHelperTest < Test::Unit::TestCase
assert_dom_equal expected, _erbout
end
+ def test_form_for_with_existing_object_and_namespace_in_list
+ @post.new_record = false
+ @comment.save
+ _erbout = ''
+ form_for([:admin, @post, @comment]) {}
+
+ expected = %(<form action="#{admin_comment_path(@post, @comment)}" class="edit_comment" id="edit_comment_1" method="post"><div style="margin:0;padding:0"><input name="_method" type="hidden" value="put" /></div></form>)
+ assert_dom_equal expected, _erbout
+ end
+
+ def test_form_for_with_new_object_and_namespace_in_list
+ @post.new_record = false
+ _erbout = ''
+ form_for([:admin, @post, @comment]) {}
+
+ expected = %(<form action="#{admin_comments_path(@post)}" class="new_comment" id="new_comment" method="post"></form>)
+ assert_dom_equal expected, _erbout
+ end
+
def test_form_for_with_existing_object_and_custom_url
_erbout = ''
@@ -660,6 +679,16 @@ class FormHelperTest < Test::Unit::TestCase
end
alias_method :post_comment_path, :comment_path
+ def admin_comments_path(post)
+ "/admin/posts/#{post.id}/comments"
+ end
+ alias_method :admin_post_comments_path, :admin_comments_path
+
+ def admin_comment_path(post, comment)
+ "/admin/posts/#{post.id}/comments/#{comment.id}"
+ end
+ alias_method :admin_post_comment_path, :admin_comment_path
+
def posts_path
"/posts"
end