Skip to content

Commit

Permalink
better example for or method
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 18, 2012
1 parent e934b75 commit e005c46
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,6 +1,8 @@

3.11 2012-07-18
- Added or method to Test::Mojo. (moritz, sri)
- Improved documentation.
- Improved tests.

3.10 2012-07-17
- Improved tests.
Expand Down
2 changes: 1 addition & 1 deletion lib/Test/Mojo.pm
Expand Up @@ -629,7 +629,7 @@ Invoke callback if previous test failed.
# Diagnostics
$t->get_ok('/bad')->or(sub { diag 'Must have been Glen!' })
->status_is(200)->or(sub { diag shift->tx->res->dom->at('title')->text });
->status_is(200)->or(sub { diag $t->tx->res->dom->at('title')->text });
=head2 C<patch_ok>
Expand Down
5 changes: 2 additions & 3 deletions t/mojolicious/testing_app.t
Expand Up @@ -17,14 +17,13 @@ use Test::Mojo;
# "Anything less than immortality is a complete waste of time!"
my $t = Test::Mojo->new('MojoliciousTest');
my $or = '';
$t->or(sub { $or .= shift->ua->name })->or(sub { $or .= shift->ua->name });
$t->or(sub { $or .= $t->ua->name })->or(sub { $or .= shift->ua->name });
is $or, 'Mojolicious (Perl)Mojolicious (Perl)',
'both callbacks have been invoked';

# SyntaxError::foo in testing mode (syntax error in controller)
$t->get_ok('/syntax_error/foo')->status_is(500)
->or(sub { $or .= shift->ua->name })
->header_is(Server => 'Mojolicious (Perl)')
->or(sub { $or .= $t->ua->name })->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_like(qr/Testing Missing/);
is $or, 'Mojolicious (Perl)Mojolicious (Perl)',
Expand Down

0 comments on commit e005c46

Please sign in to comment.