Skip to content

Commit

Permalink
better test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 23, 2011
1 parent 432c38a commit 9c4fec1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,10 +1,11 @@
This file documents the revision history for Perl extension Mojolicious.

2.40 2011-12-23 00:00:00
2.40 2011-12-24 00:00:00
- Deprecated Test::Mojo->json_content_is in favor of
Test::Mojo->json_is.
- Added EXPERIMENTAL JSON Pointer support. (crab)
- Improved inactivity timeouts by allowing them to be disabled.
- Improved documentation.
- Fixed repository to not favor specific editors.

2.39 2011-12-22 00:00:00
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -624,7 +624,7 @@ You can also extract all text from nested child elements.

The request can be customized as well.

$ mojo get --method post --content 'Hello!' http://mojolicio.us
$ mojo get --method POST --content 'Hello!' http://mojolicio.us
$ mojo get --header 'X-Bender: Bite my shiny metal ass!' http://google.com

You can follow redirects and view the headers for all messages.
Expand Down
14 changes: 4 additions & 10 deletions lib/Test/Mojo.pm
Expand Up @@ -390,24 +390,18 @@ Test::Mojo - Testing Mojo!
=head1 SYNOPSIS
use Test::More tests => 10;
use Test::More tests => 12;
use Test::Mojo;
my $t = Test::Mojo->new('MyApp');
$t->get_ok('/welcome')
->status_is(200)
->content_like(qr/Hello!/, 'welcome message');
$t->post_form_ok('/search', {title => 'Perl', author => 'taro'})
->status_is(200)
->content_like(qr/Perl.+taro/);
$t->get_ok('/welcome')->status_is(200)->text_is('div#message' => 'Hello!');
$t->delete_ok('/something')
$t->post_form_ok('/search.json' => {q => 'Perl'})
->status_is(200)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->header_isnt('X-Bender' => 'Bite my shiny metal ass!');
->content_is('Hello world!');
->json_is('/results/4/title' => 'Perl rocks!');
$t->websocket_ok('/echo')
->send_message_ok('hello')
Expand Down

0 comments on commit 9c4fec1

Please sign in to comment.