PageRenderTime 27ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/t/messages.t

http://github.com/gshank/html-formhandler
text | 25 lines | 21 code | 4 blank | 0 comment | 0 complexity | 6957befdcd6055791109a6bb250e17d9 MD5 | raw file
 1use strict;
 2use warnings;
 3use Test::More;
 4
 5{
 6    package Test::Form;
 7    use HTML::FormHandler::Moose;
 8    extends 'HTML::FormHandler';
 9
10    sub build_messages {
11        {
12            required => 'You must supply this field',
13        }
14    }
15    has_field 'foo' => ( type => 'Text', required => 1 );
16    has_field 'bar';
17}
18
19my $form = Test::Form->new;
20ok( $form, 'form built');
21$form->process( params => { bar => 1} );
22my @errors = $form->errors;
23is( $errors[0], 'You must supply this field', 'form has errors' );
24
25done_testing;