Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Allow tests to run properly
Browse files Browse the repository at this point in the history
- Proper testing directories
- Added cleanup of test db
  • Loading branch information
mfontani committed Feb 22, 2011
1 parent d618f3e commit 37360d8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.yml
Expand Up @@ -23,6 +23,7 @@ engines:
path:
- /
- ./views
- ../views

# Admin user sessions stored in cookie -- change the cookie key!
session: "cookie"
Expand Down
9 changes: 8 additions & 1 deletion t/001_base.t
@@ -1,5 +1,12 @@
use Test::More tests => 1;
use Test::More tests => 2;
use strict;
use warnings;

use_ok 'Brocco';

chdir 't/';

diag("Deploying development schema..");
rename('brocco.db','brocco.db.old') if -f 'brocco.db';
qx{../bin/deploy_schema ../environments/development.yml};
ok(-f 'brocco.db') or BAIL_OUT("Need brocco.db to continue further testing");
1 change: 1 addition & 0 deletions t/002_index_route.t
Expand Up @@ -4,6 +4,7 @@ use warnings;

# the order is important
use Brocco;
BEGIN{ chdir 't/' }
use Dancer::Test;

route_exists [ GET => '/' ], 'a route handler is defined for /';
Expand Down
1 change: 1 addition & 0 deletions t/003-article-N.t
Expand Up @@ -4,6 +4,7 @@ use warnings;

# the order is important
use Brocco;
BEGIN{ chdir 't/' }
use Dancer::Test;

route_exists [ GET => '/article/1' ], 'a route handler is defined for /article/1';
Expand Down
1 change: 1 addition & 0 deletions t/004-admin-login.t
Expand Up @@ -4,6 +4,7 @@ use warnings;

# the order is important
use Brocco;
BEGIN{ chdir 't/' }
use Dancer::Test;
use Data::Dumper;

Expand Down
1 change: 1 addition & 0 deletions t/004-admin.t
Expand Up @@ -4,6 +4,7 @@ use warnings;

# the order is important
use Brocco;
BEGIN{ chdir 't/' }
use Dancer::Test;
use Data::Dumper;

Expand Down
11 changes: 11 additions & 0 deletions t/999-cleanup.t
@@ -0,0 +1,11 @@
use Test::More tests => 2;
use strict;
use warnings;

chdir 't/';

ok(-f 'brocco.db');

unlink 'brocco.db';

ok(!-f 'brocco.db');

0 comments on commit 37360d8

Please sign in to comment.