aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/active_record_helper_test.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-07-31 16:21:07 -0300
committerEmilio Tagua <miloops@gmail.com>2009-07-31 16:21:07 -0300
commit3de59e916d6a3d4eab202cf0c99b1f88905a3b43 (patch)
treedef6d6a808ebe187be1f37f8a739fd786cc11f02 /actionpack/test/template/active_record_helper_test.rb
parentc1cbf02e3170f1004daf4a146cbc41176c2458d3 (diff)
parent62fd1d3716b4b5fd1d91cdcc77003efe80fc5a7e (diff)
downloadrails-3de59e916d6a3d4eab202cf0c99b1f88905a3b43.tar.gz
rails-3de59e916d6a3d4eab202cf0c99b1f88905a3b43.tar.bz2
rails-3de59e916d6a3d4eab202cf0c99b1f88905a3b43.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record/associations.rb
Diffstat (limited to 'actionpack/test/template/active_record_helper_test.rb')
-rw-r--r--actionpack/test/template/active_record_helper_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb
index b07ce6cf5d..ec3384f15d 100644
--- a/actionpack/test/template/active_record_helper_test.rb
+++ b/actionpack/test/template/active_record_helper_test.rb
@@ -295,6 +295,16 @@ class ActiveRecordHelperTest < ActionView::TestCase
assert_equal '', error_messages_for('user', :object => nil)
end
+ def test_error_messages_for_model_objects
+ error = error_messages_for(@post)
+ assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>1 error prohibited this post from being saved</h2><p>There were problems with the following fields:</p><ul><li>Author name can't be empty</li></ul></div>),
+ error
+
+ error = error_messages_for(@user, @post)
+ assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>2 errors prohibited this user from being saved</h2><p>There were problems with the following fields:</p><ul><li>User email can't be empty</li><li>Author name can't be empty</li></ul></div>),
+ error
+ end
+
def test_form_with_string_multipart
assert_dom_equal(
%(<form action="create" enctype="multipart/form-data" method="post"><p><label for="post_title">Title</label><br /><input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /></p>\n<p><label for="post_body">Body</label><br /><div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div></p><input name="commit" type="submit" value="Create" /></form>),