Navigation Menu

Skip to content

Commit

Permalink
added tests for static_class stash value
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 12, 2012
1 parent 4406a97 commit cdb5788
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -4,6 +4,7 @@ This file documents the revision history for Perl extension Mojolicious.
- Improved version command to be more responsive. (crab)
- Improved resilience of Mojo::IOLoop::Client.
- Improved documentation.
- Improved tests.
- Fixed parent combinator bug in Mojo::DOM::CSS. (sharifulin, sri)

2.48 2012-02-09 00:00:00
Expand Down
8 changes: 7 additions & 1 deletion t/mojolicious/app.t
Expand Up @@ -7,7 +7,7 @@ BEGIN {
$ENV{MOJO_MODE} = 'development';
}

use Test::More tests => 275;
use Test::More tests => 280;

use FindBin;
use lib "$FindBin::Bin/lib";
Expand Down Expand Up @@ -298,6 +298,12 @@ $t->get_ok('/foo/data_template2')->status_is(200)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_is("This one works too!\n");

# SingleFileTestApp::Foo::data_static
$t->get_ok('/foo/data_static')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_is("And this one... ALL GLORY TO THE HYPNOTOAD!\n");

# SingleFileTestApp::Foo::bar
$t->get_ok('/foo/bar')->status_is(200)
->header_is('X-Bender' => 'Bite my shiny metal ass!')
Expand Down
8 changes: 8 additions & 0 deletions t/mojolicious/lib/SingleFileTestApp.pm
Expand Up @@ -45,6 +45,12 @@ sub data_template2 {
);
}

sub data_static {
my $self = shift;
$self->stash(static_class => __PACKAGE__);
$self->render_static('singlefiletestapp/foo.txt');
}

sub index { shift->stash(template => 'withlayout', msg => 'works great!') }

1;
Expand All @@ -53,3 +59,5 @@ __DATA__
<%= 20 + 3 %> works!
@@ too.html.epl
This one works too!
@@ singlefiletestapp/foo.txt
And this one... ALL GLORY TO THE HYPNOTOAD!

0 comments on commit cdb5788

Please sign in to comment.