0
@@ -10,17 +10,17 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
alias_method :body_before_type_cast, :body unless respond_to?(:body_before_type_cast)
0
alias_method :author_name_before_type_cast, :author_name unless respond_to?(:author_name_before_type_cast)
0
User = Struct.new("User", :email)
0
alias_method :email_before_type_cast, :email unless respond_to?(:email_before_type_cast)
0
Column = Struct.new("Column", :type, :name, :human_name)
0
@@ -33,12 +33,12 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
- def empty?() false end
0
+ def empty?() false end
0
def full_messages() [ "Author name can't be empty" ] end
0
def @post.new_record?() true end
0
def @post.to_param() nil end
0
@@ -58,16 +58,16 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
def on(field) field == "email" end
0
- def empty?() false end
0
+ def empty?() false end
0
def full_messages() [ "User email can't be empty" ] end
0
def @user.new_record?() true end
0
def @user.to_param() nil end
0
@@ -81,7 +81,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
def protect_against_forgery?
0
@protect_against_forgery ? true : false
0
@@ -92,7 +92,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
@response = ActionController::TestResponse.new
0
@controller = Object.new
0
def @controller.url_for(options)
0
options = options.symbolize_keys
0
@@ -111,7 +111,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
%(<div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div>),
0
text_area("post", "body")
0
def test_text_field_with_errors
0
@@ -140,7 +140,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
def test_form_with_protect_against_forgery
0
@protect_against_forgery = true
0
@request_forgery_protection_token = 'authenticity_token'
0
@@ -150,7 +150,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
def test_form_with_method_option
0
%(<form action="create" method="get"><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>),
0
@@ -211,9 +211,9 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
assert_dom_equal "<div class=\"formError\">can't be empty</div>", error_message_on(other_post, :author_name)
0
- def test_error_message_on_should_use_options
0
- assert_dom_equal "<div class=\"differentError\">beforecan't be emptyafter</div>", error_message_on(:post, :author_name, "before", "after", "differentError")
0
+ def test_error_message_on_with_options_hash
0
+ assert_dom_equal "<div class=\"differentError\">beforecan't be emptyafter</div>", error_message_on(:post, :author_name, :css_class => 'differentError', :prepend_text => 'before', :append_text => 'after')
0
def test_error_messages_for_many_objects
0
@@ -224,10 +224,10 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
# add the default to put post back in the title
0
assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>2 errors prohibited this post 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_messages_for("user", "post", :object_name => "post")
0
assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>2 errors prohibited this post 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_messages_for(:user, :post, :object_name => :post)
0
# any default works too
0
assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>2 errors prohibited this monkey 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_messages_for(:user, :post, :object_name => "monkey")
0
@@ -242,7 +242,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
message = "Please fix the following fields and resubmit:"
0
assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>#{header_message}</h2><p>#{message}</p><ul><li>User email can't be empty</li><li>Author name can't be empty</li></ul></div>), error_messages_for(:user, :post, :header_message => header_message, :message => message)
0
def test_error_messages_for_non_instance_variable
0
@@ -251,14 +251,14 @@ class ActiveRecordHelperTest < ActionView::TestCase
0
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_messages_for("post", :object => actual_post)
0
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_messages_for("user", "post", :object => [actual_user, actual_post])
0
assert_equal '', error_messages_for('user', :object => nil)
0
def test_form_with_string_multipart
0
%(<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>),