Skip to content

Commit

Permalink
better content negotiation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 6, 2012
1 parent 74a80a0 commit 0d15a95
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion t/mojolicious/twinkle_lite_app.t
Expand Up @@ -6,7 +6,7 @@ BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More tests => 23;
use Test::More tests => 29;

# "Pizza delivery for...
# I. C. Weiner. Aww... I always thought by this stage in my life I'd be the
Expand Down Expand Up @@ -54,6 +54,14 @@ get '/docs2' => {codename => 'snowman'} => 'docs2';
# GET /docs3
get '/docs3' => sub { shift->stash(codename => undef) } => 'docs';

# GET /rest
get '/rest' => sub {
shift->respond_to(
foo => {text => 'foo works!'},
html => {text => 'html works!'}
);
};

# GET /dead
get '/dead' => sub {die};

Expand All @@ -75,6 +83,12 @@ $t->get_ok('/docs2')->status_is(200)->content_like(qr!<h2>snowman</h2>!);
# GET /docs3
$t->get_ok('/docs3')->status_is(200)->content_like(qr!<h3></h3>!);

# GET /rest (foo format)
$t->get_ok('/rest')->status_is(200)->content_is('foo works!');

# GET /rest.html (html format)
$t->get_ok('/rest.html')->status_is(200)->content_is('html works!');

# GET /perldoc (disabled)
$t->get_ok('/perldoc')->status_is(404)->content_is("Whatever not found!\n");

Expand Down

0 comments on commit 0d15a95

Please sign in to comment.