1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

full_error can be disabled with error: false and full_error: false

This commit is contained in:
Rafael Mendonça França 2014-04-03 18:00:07 -03:00
parent 1529c0ed58
commit 5eb901deec
2 changed files with 15 additions and 1 deletions

View file

@ -6,7 +6,7 @@ module SimpleForm
end end
def full_error(wrapper_options = nil) def full_error(wrapper_options = nil)
full_error_text if has_errors? full_error_text if options[:error] != false && has_errors?
end end
def has_errors? def has_errors?

View file

@ -132,4 +132,18 @@ class ErrorTest < ActionView::TestCase
assert_select 'span.error', 'Company must be valid' assert_select 'span.error', 'Company must be valid'
end end
end end
test 'full error can be disabled' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
with_form_for @user, :company_id, as: :select, full_error: false
assert_no_select 'span.error'
end
end
test 'full error can be disabled setting error to false' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
with_form_for @user, :company_id, as: :select, error: false
assert_no_select 'span.error'
end
end
end end