Skip to content

Commit

Permalink
added example for sending JSON messages with Test::Mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 3, 2013
1 parent 0a0cbde commit d6adfa6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,4 +1,7 @@

3.93 2013-04-04
- Improved documentation.

3.92 2013-04-03
- Added monotonic clock support to make Mojolicious more resilient to time
jumps.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -40,7 +40,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Rainbow';
our $VERSION = '3.92';
our $VERSION = '3.93';

sub AUTOLOAD {
my $self = shift;
Expand Down
12 changes: 11 additions & 1 deletion lib/Test/Mojo.pm
Expand Up @@ -387,6 +387,8 @@ sub _wait {

1;

=encoding utf8
=head1 NAME
Test::Mojo - Testing Mojo!
Expand Down Expand Up @@ -698,7 +700,7 @@ Opposite of C<json_message_has>.
=head2 json_message_is
$t = $t->json_message_is('/' => {foo => [1, 2, 3]});
$t = $t->json_message_is('' => {foo => [1, 2, 3]});
$t = $t->json_message_is('/foo' => [1, 2, 3]);
$t = $t->json_message_is('/foo/1' => 2, 'right value');
Expand Down Expand Up @@ -841,6 +843,14 @@ Reset user agent session.
Send message or frame via WebSocket.
# Send JSON object as "Text" message
use Mojo::JSON 'j';
$t->websocket_ok('/echo.json')
->send_ok({text => j({test => 'I ♥ Mojolicious!'})})
->message_ok
->json_message_is('' => {test => 'I ♥ Mojolicious!'})
->finish_ok;
=head2 status_is
$t = $t->status_is(200);
Expand Down

0 comments on commit d6adfa6

Please sign in to comment.