X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=t%2F1.t;h=3aaa0e986c231f345abcb50447cbf82af24a9e44;hb=85968ef28d078868c8e2865a3e76f81ddd4ec94c;hp=77c1f9fdef874ff5a28d60a76fc46e2acdebd91b;hpb=fb48746a79e660e7f5df5a22269ca9e22519eaa5;p=maypole.git diff --git a/t/1.t b/t/1.t index 77c1f9f..3aaa0e9 100644 --- a/t/1.t +++ b/t/1.t @@ -1,14 +1,15 @@ # vim:ft=perl -use Test::More tests => 5; +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"); -@ARGV = ("http://localhost/beerdb/"); -is(BeerDB->handler, 200, "OK"); -like($Maypole::CLI::buffer, qr/frontpage/, "Got the front page"); - -@ARGV = ("http://localhost/beerdb/beer/list"); -is(BeerDB->handler, 200, "OK"); -like($Maypole::CLI::buffer, qr/Organic Best/, "Found a beer in the list"); +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");