]> git.decadent.org.uk Git - maypole.git/blobdiff - t/1.t
support use Maypole qw/Redirect Poop/ syntax. (Maypole::Poop soon to follow)
[maypole.git] / t / 1.t
diff --git a/t/1.t b/t/1.t
index be5e6bdac57f11a880cbf59019bab09e66887d00..3aaa0e986c231f345abcb50447cbf82af24a9e44 100644 (file)
--- a/t/1.t
+++ b/t/1.t
@@ -1,15 +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, OK, "OK");
-like($Maypole::CLI::buffer, qr/frontpage/, "Got the front page");
-
-@ARGV = ("http://localhost/beerdb/beer/list");
-is(BeerDB->handler, OK, "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");