diff --git a/lib/simple_form/components/errors.rb b/lib/simple_form/components/errors.rb index c0ed3402..55a63afa 100644 --- a/lib/simple_form/components/errors.rb +++ b/lib/simple_form/components/errors.rb @@ -6,7 +6,7 @@ module SimpleForm end def full_error(wrapper_options = nil) - full_error_text if has_errors? + full_error_text if options[:error] != false && has_errors? end def has_errors? diff --git a/test/form_builder/error_test.rb b/test/form_builder/error_test.rb index bcdf99f8..aa96b274 100644 --- a/test/form_builder/error_test.rb +++ b/test/form_builder/error_test.rb @@ -132,4 +132,18 @@ class ErrorTest < ActionView::TestCase assert_select 'span.error', 'Company must be valid' 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