Skip to content

Commit

Permalink
more format detection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 15, 2012
1 parent 90077c7 commit 85d9487
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion t/mojolicious/group_lite_app.t
Expand Up @@ -8,7 +8,7 @@ BEGIN {
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}

use Test::More tests => 154;
use Test::More tests => 169;

# "Let's see how crazy I am now, Nixon. The correct answer is very."
use Mojo::ByteStream 'b';
Expand Down Expand Up @@ -177,6 +177,17 @@ group {
# GET /noauthgroup
get '/noauthgroup' => {inline => 'Whatever <%= $foo %>.'};

# Disable format detection
under [format => 0];

# GET /no_format
get '/no_format' => {text => 'No format detection.'};

# GET /some_formats.txt
# GET /some_formats.html
get '/some_formats' => [format => [qw/txt html/]] =>
{text => 'Some format detection.'};

my $t = Test::Mojo->new;

# GET /with_under
Expand Down Expand Up @@ -367,6 +378,26 @@ $t->get_ok('/authgroup')->status_is(200)->content_is("You're not ok.");
# GET /noauthgroup
$t->get_ok('/noauthgroup')->status_is(200)->content_is("Whatever one.\n");

# GET /no_format
$t->get_ok('/no_format')->status_is(200)->content_is('No format detection.');

# GET /no_format.txt
$t->get_ok('/no_format.txt')->status_is(404);

# GET /some_formats
$t->get_ok('/some_formats')->status_is(404);

# GET /some_formats.txt
$t->get_ok('/some_formats.txt')->status_is(200)
->content_is('Some format detection.');

# GET /some_formats.html
$t->get_ok('/some_formats.html')->status_is(200)
->content_is('Some format detection.');

# GET /some_formats.xml
$t->get_ok('/some_formats.xml')->status_is(404);

__DATA__
@@ not_found.html.epl
Oops!
Expand Down

0 comments on commit 85d9487

Please sign in to comment.