-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a `log_die` helper which can be used to make sure a log is generated in a helper when an exception might be captured. Thanks @stephan48 for reporting this issue! Fixes #126
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,4 +225,20 @@ subtest 'run mask filter' => sub { | |
'filter on object is run'; | ||
}; | ||
|
||
subtest 'filter not found error' => sub { | ||
$t->app->log->history([]); | ||
local $t->app->yancy->config->{schema}{user}{properties}{email}{'x-filter'}[0] = [ 'DOES.NOT.EXIST' ]; | ||
my $user = { | ||
username => 'filter', | ||
email => '[email protected]', | ||
password => 'unfiltered', | ||
}; | ||
eval { $t->app->yancy->filter->apply( user => $user ) }; | ||
ok my $err = $@, 'error is thrown'; | ||
like $err, qr{Unknown filter: DOES\.NOT\.EXIST}; | ||
ok my $log = shift @{ $t->app->log->history }, 'log exists'; | ||
is $log->[1], 'fatal', 'log level is fatal'; | ||
like $log->[2], qr{Unknown filter: DOES\.NOT\.EXIST}, 'log message is correct'; | ||
}; | ||
|
||
done_testing; |