From 01cfda7cf280b5050b4431790702d63a956190c2 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 14 Oct 2007 02:59:32 +0000 Subject: error_messages_for also takes :message and :header_message options which defaults to the old "There were problems with the following fields:" and " errors prohibited this from being saved". Closes #8270. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7870 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/active_record_helper_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index 4630cbc1f3..6ef74aa8e7 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -207,6 +207,14 @@ class ActiveRecordHelperTest < Test::Unit::TestCase # should space object name assert_dom_equal %(

2 errors prohibited this chunky bacon from being saved

There were problems with the following fields:

  • User email can't be empty
  • Author name can't be empty
), error_messages_for(:user, :post, :object_name => "chunky_bacon") + + # hide header and explanation messages with nil or empty string + assert_dom_equal %(
  • User email can't be empty
  • Author name can't be empty
), error_messages_for(:user, :post, :header_message => nil, :message => "") + + # override header and explanation messages + header_message = "Yikes! Some errors" + message = "Please fix the following fields and resubmit:" + assert_dom_equal %(

#{header_message}

#{message}

  • User email can't be empty
  • Author name can't be empty
), error_messages_for(:user, :post, :header_message => header_message, :message => message) end def test_error_messages_for_non_instance_variable -- cgit v1.2.3