X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=t%2F1.t;h=3aaa0e986c231f345abcb50447cbf82af24a9e44;hb=5f530b5f17106319faa2f437a567332c86bf6a2c;hp=ff8ae7347db6a2b5f7a7e566147f96803dde4f69;hpb=feefb416b3c1aafdea07aa47378d007ee760e9f9;p=maypole.git diff --git a/t/1.t b/t/1.t index ff8ae73..3aaa0e9 100644 --- a/t/1.t +++ b/t/1.t @@ -1,23 +1,15 @@ # vim:ft=perl -use Test::More 'no_plan'; - -package Fake::Loader; - -package Fake::MVC; -use base 'Apache::MVC'; - -sub set_database { - my $self = shift; - $self->config->{loader} = bless {}, Fake::Loader; -} - -sub get_request {} - -sub parse_location { - my $self = shift; - my @pi = @Fake::MVC::url; - shift @pi while @pi and !$pi[0]; - $self->{table} = shift @pi; - $self->{action} = shift @pi; - $self->{args} = \@pi; -} +use Test::More; +use lib 'ex'; # Where BeerDB should live +BEGIN { if (eval { require BeerDB }) { + plan tests => 3; + } else { Test::More->import(skip_all =>"SQLite not working or BeerDB module could not be loaded: $@") } + } +use Maypole::CLI qw(BeerDB); +use Maypole::Constants; +$ENV{MAYPOLE_TEMPLATES} = "t/templates"; + +isa_ok( (bless {},"BeerDB") , "Maypole"); + +like(BeerDB->call_url("http://localhost/beerdb/"), qr/frontpage/, "Got the front page"); +like(BeerDB->call_url("http://localhost/beerdb/beer/list"), qr/Organic Best/, "Found a beer in the list");