diff options
author | franck cuny <franck@lumberjaph.net> | 2011-02-14 21:37:36 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2011-02-14 21:37:36 +0100 |
commit | b1288aa3f613f0f401adec6b69f153a2fd28edf4 (patch) | |
tree | 13bb0084d87b2062bd28672d9b95de6a713ac72a | |
parent | update README (diff) | |
download | jitterbug-b1288aa3f613f0f401adec6b69f153a2fd28edf4.tar.gz |
start to add tests on views
Diffstat (limited to '')
-rw-r--r-- | t/002_index_route.t | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/t/002_index_route.t b/t/002_index_route.t index f6fe11b..0b8facc 100644 --- a/t/002_index_route.t +++ b/t/002_index_route.t @@ -1,16 +1,47 @@ -use Test::More tests => 1; +use Test::More tests => 4; use strict; use warnings; -ok 1; -# the order is important -#use jitterbug; -#use Dancer::Test; -#use Dancer::Config qw/setting/; +use jitterbug; +use jitterbug::Schema; -#setting jitterbug => {namespace => 'jitterbug_test'}; +use Dancer::Test; +use Dancer::Config qw/setting/; -#route_exists [ GET => '/' ], 'a route handler is defined for /'; -#response_status_is [ GET => '/' ], 200, 'response status is 200 for /'; -#response_content_like [ GET => '/' ], qr/Dashboard/, 'content looks OK for /'; -#response_content_like [ GET => '/' ], qr/Repositories \(0\)/, 'no repositories'; +use YAML qw/LoadFile/; +use File::Spec; +use File::Temp qw/tempdir/; + +my $content = LoadFile('t/data/test.yaml'); + +my $db_dir = tempdir( CLEANUP => 1 ); +my $db_file = File::Spec->catfile( $db_dir, 'jitterbug.db' ); +my $dsn = 'dbi:SQLite:dbname=' . $db_file; +my $schema = jitterbug::Schema->connect($dsn); +$schema->deploy; + +setting layout => 'main'; +setting template => "xslate"; +setting views => 'views'; +setting engines => { + xslate => { + path => '/', + type => 'text', + cache => 0, + } +}; + +setting plugins => { + DBIC => { + schema => { + skip_automake => 1, + pckg => "jitterbug::Schema", + connect_info => [$dsn] + } + } +}; + +route_exists [ GET => '/' ], 'a route handler is defined for /'; +response_status_is [ GET => '/' ], 200, 'response status is 200 for /'; +response_content_like [ GET => '/' ], qr/Dashboard/, 'content looks OK for /'; +response_content_like [ GET => '/' ], qr/Repositories \(0\)/, 'no repositories'; |