Setting custom field_error_proc test

This commit is contained in:
dfens 2013-04-29 17:13:33 +02:00
parent 1c886ff653
commit 7561a014da
2 changed files with 8 additions and 1 deletions

View File

@ -139,7 +139,7 @@ module SimpleForm
mattr_accessor :button_class
@@button_class = 'button'
# Override the default ActiveRecordHelper behaviour of wrapping the input.
# Override the default ActiveModelHelper behaviour of wrapping the input.
# This gets taken care of semantically by adding an error class to the wrapper tag
# containing the input.
mattr_accessor :field_error_proc

View File

@ -131,6 +131,13 @@ class FormHelperTest < ActionView::TestCase
end
end
test 'custom field error proc' do
expected_error_proc = lambda {}
swap SimpleForm, field_error_proc: expected_error_proc do
assert_equal expected_error_proc, SimpleForm.field_error_proc
end
end
private
def swap_field_error_proc(expected_error_proc = lambda {})