]> git.decadent.org.uk Git - maypole.git/blob - t/01basics.t
Test::MockObject isn't a dependency, add helper for dynamic prereq_pm (which may...
[maypole.git] / t / 01basics.t
1 # vim:ft=perl
2 use Test::More;
3 use lib 'ex'; # Where BeerDB should live
4 BEGIN { if (eval { require BeerDB }) { 
5             plan tests => 12;
6         } else { Test::More->import(skip_all =>"SQLite not working or BeerDB module could not be loaded: $@") }
7       }
8 use Maypole::CLI qw(BeerDB);
9 use Maypole::Constants;
10 $ENV{MAYPOLE_TEMPLATES} = "t/templates";
11
12 isa_ok( (bless {},"BeerDB") , "Maypole");
13
14 like(BeerDB->call_url("http://localhost/beerdb/"), qr/frontpage/, "Got the front page");
15 like(BeerDB->call_url("http://localhost/beerdb/beer/list"), qr/Organic Best/, "Found a beer in the list");
16 my (%classdata)=split /\n/, BeerDB->call_url("http://localhost/beerdb/beer/classdata");
17 is ($classdata{plural},'beers','classdata.plural');
18 is ($classdata{moniker},'beer','classdata.moniker');
19 like ($classdata{cgi},qr/^HTML::Element/,'classdata.cgi');
20 is ($classdata{table},'beer','classdata.table');
21 is ($classdata{name},'BeerDB::Beer','classdata.name');
22 is ($classdata{colnames},'Abv','classdata.colnames');
23 is($classdata{columns}, 'abv brewery id name notes price score style url',
24    'classdata.columns');
25 is($classdata{list_columns}, 'score name price style brewery url',
26    'classdata.list_columns');
27 is ($classdata{related_accessors},'pubs','classdata.related_accessors');
28