Skip to content

Commit

Permalink
fixed warning in Test::Mojo (closes #400)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 20, 2012
1 parent 9f531cb commit 016e558
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,6 +1,8 @@

3.51 2012-10-21
- Improved documentation.
- Improved tests.
- Fixed warning in Test::Mojo.

3.50 2012-10-20
- Improved option handling of all commands.
Expand Down
9 changes: 4 additions & 5 deletions lib/Test/Mojo.pm
Expand Up @@ -125,16 +125,15 @@ sub header_isnt {

sub header_like {
my ($self, $name, $regex, $desc) = @_;
$desc ||= "$name is similar";
return $self->_test('like', scalar $self->tx->res->headers->header($name),
$regex, $desc);
$regex, $desc || "$name is similar");
}

sub header_unlike {
my ($self, $name, $regex, $desc) = @_;
$desc ||= "$name is not similar";
return $self->_test('unlike', scalar $self->tx->res->headers->header($name),
$regex, $desc);
return $self->_test('unlike',
scalar $self->tx->res->headers->header($name) // '',
$regex, $desc || "$name is not similar");
}

sub json_content_is {
Expand Down
4 changes: 3 additions & 1 deletion t/mojolicious/app.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More tests => 349;
use Test::More tests => 351;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand Down Expand Up @@ -65,7 +65,9 @@ my $url = $t->ua->app_url;
$url->path('/fun/time');
$t->get_ok($url => {'X-Test' => 'Hi there!'})->status_isnt(404)
->status_is(200)->header_isnt('X-Bender' => 'Bite my shiny metal ass!')
->header_unlike('X-Bender' => qr/shiny metal/)
->header_is('X-Bender' => undef)->header_is(Server => 'Mojolicious (Perl)')
->header_unlike(Server => qr/Bender/)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')->content_isnt('Have')
->content_is('Have fun!');

Expand Down

0 comments on commit 016e558

Please sign in to comment.