Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved send_ok method in Test::Mojo to be able to fail gracefully
  • Loading branch information
kraih committed Nov 25, 2014
1 parent 650220d commit 49790e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
@@ -1,5 +1,6 @@

5.66 2014-11-25
- Improved send_ok method in Test::Mojo to be able to fail gracefully.
- Fixed bug in Mojo::DOM::CSS where the :empty pseudo class would not ignore
comments and processing instructions.

Expand Down
6 changes: 5 additions & 1 deletion lib/Test/Mojo.pm
Expand Up @@ -258,9 +258,13 @@ sub reset_session {

sub send_ok {
my ($self, $msg, $desc) = @_;

$desc ||= 'send message';
return $self->_test('ok', 0, $desc) unless $self->tx->is_websocket;

$self->tx->send($msg => sub { Mojo::IOLoop->stop });
Mojo::IOLoop->start;
return $self->_test('ok', 1, $desc || 'send message');
return $self->_test('ok', 1, $desc);
}

sub status_is {
Expand Down

0 comments on commit 49790e4

Please sign in to comment.