Skip to content

Commit

Permalink
triggers were not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 21, 2011
1 parent 2549cc3 commit 55bb38a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/Test/Mojo.pm
Expand Up @@ -250,9 +250,8 @@ sub reset_session {
sub send_message_ok {
my ($self, $message, $desc) = @_;

my $t = Mojo::IOLoop->trigger;
$self->tx->send_message($message, $t->begin);
$t->start;
$self->tx->send_message($message, sub { Mojo::IOLoop->stop });
Mojo::IOLoop->start;
local $Test::Builder::Level = $Test::Builder::Level + 1;
Test::More::ok 1, $desc || 'send message';

Expand Down Expand Up @@ -317,18 +316,16 @@ sub websocket_ok {
utf8::encode $desc;
$self->{messages} = [];
$self->{finished} = 0;
my $t = Mojo::IOLoop->trigger;
$t->begin;
$self->ua->websocket(
$url, @_,
sub {
$self->tx(my $tx = pop);
$tx->on_finish(sub { $self->{finished} = 1 });
$tx->on_message(sub { push @{$self->{messages}}, pop });
$t->end;
Mojo::IOLoop->stop;
}
);
$t->start;
Mojo::IOLoop->start;
local $Test::Builder::Level = $Test::Builder::Level + 1;
Test::More::ok $self->tx->res->code eq 101, $desc;

Expand Down

0 comments on commit 55bb38a

Please sign in to comment.