Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (36 sloc) 0.952 kb
use strict;
use warnings;
use File::Spec;
use File::Basename 'dirname';
use Test::More;
eval { require Template; Template->import(); 1 }
or plan skip_all => 'Template::Toolkit probably missing.';
my $views = File::Spec->rel2abs(
File::Spec->catfile(dirname(__FILE__), 'views'));
package Foo;
use Dancer 2.0;
set views => $views;
set session => 'simple';
set template => "template_toolkit";
set foo => "in settings";
get '/set_vars' => sub {
session foo => "in session";
get '/view/:foo' => sub {
var foo => "in var";
template "tokens";
use Dancer::Test 'Foo';
my $expected = "perl_version: $]
dancer_version: ${Dancer::VERSION} in settings 42 in session in var";
dancer_response "/set_vars";
response_content_like "/view/42",
"Response contains all expected tokens";
Jump to Line
Something went wrong with that request. Please try again.