Skip to content

Commit

Permalink
added error message for in check
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 27, 2013
1 parent d05705c commit 1f74004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/Mojolicious/Validator.pm
Expand Up @@ -9,6 +9,7 @@ has checks => sub {
has errors => sub {
{
equal_to => sub {'Values are not equal.'},
in => sub {'Value is not allowed.'},
required => sub {'Value is required.'},
size => sub {qq{Value needs to be $_[3]-$_[4] characters long.}}
};
Expand Down Expand Up @@ -83,8 +84,8 @@ are already defined.
my $errors = $validator->errors;
$validator = $validator->errors({size => sub {...}});
Registered error generators, by default only C<equal_to>, C<required> and
C<size> are already defined.
Registered error generators, by default only C<equal_to>, C<in>, C<required>
and C<size> are already defined.
=head1 METHODS
Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/validation_lite_app.t
Expand Up @@ -72,7 +72,7 @@ ok !$validation->has_error, 'no error';
ok !$validation->required('baz')->in(qw(yada whatever))->is_valid, 'not valid';
is_deeply $validation->output, {foo => [qw(bar whatever)]}, 'right result';
ok $validation->has_error, 'has error';
is_deeply [$validation->errors('baz')->each], ['Value is not valid.'],
is_deeply [$validation->errors('baz')->each], ['Value is not allowed.'],
'right error';

# Regex
Expand Down

0 comments on commit 1f74004

Please sign in to comment.