From e12faad1f5dfa69b3e8067609523e7da7deffe9a Mon Sep 17 00:00:00 2001 From: Faizaan Gagan Date: Tue, 8 Dec 2020 13:29:36 +0530 Subject: [PATCH] added positive test for max length check --- .../custom_wizard/update_validator_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/components/custom_wizard/update_validator_spec.rb b/spec/components/custom_wizard/update_validator_spec.rb index 8f89b623..c0e55db3 100644 --- a/spec/components/custom_wizard/update_validator_spec.rb +++ b/spec/components/custom_wizard/update_validator_spec.rb @@ -73,6 +73,23 @@ describe CustomWizard::UpdateValidator do expect( updater.errors.messages[:step_1_field_3].first ).to eq(I18n.t('wizard.field.too_long', label: 'Composer', max: max_length)) + + hundred_chars_string = "This is a line, exactly hundred characters long and not more even a single character more than that." + updater = perform_validation('step_1', step_1_field_1: hundred_chars_string) + expect( + updater.errors.messages[:step_1_field_1].first + ).to eq(nil) + + updater = perform_validation('step_1', step_1_field_2: hundred_chars_string) + expect( + updater.errors.messages[:step_1_field_2].first + ).to eq(nil) + + updater = perform_validation('step_1', step_1_field_3: hundred_chars_string) + expect( + updater.errors.messages[:step_1_field_3].first + ).to eq(nil) + end it 'standardises boolean entries' do