r957@llin: dpavlin | 2006-09-24 17:03:52 +0200
[webpac2] / t / 1-config.t
diff --git a/t/1-config.t b/t/1-config.t
new file mode 100755 (executable)
index 0000000..7385022
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More tests => 8;
+use Test::Exception;
+use blib;
+
+use Data::Dump qw/dump/;
+use Cwd qw/abs_path/;
+
+BEGIN {
+use_ok( 'WebPAC::Config' );
+}
+
+my $debug = shift @ARGV;
+
+ok(my $abs_path = abs_path($0), "abs_path");
+$abs_path =~ s#/[^/]*$#/#;
+
+my $path = "$abs_path/conf/test.yml";
+
+ok(my $c = new WebPAC::Config( path => $path ), "new");
+
+cmp_ok($c->{path}, 'eq', $path, "path $path");
+
+ok($c->{config}, "config exist");
+
+isa_ok($c->databases, 'HASH', "databases");
+
+my @names = $c->databases;
+
+isa_ok(\@names, 'ARRAY', "databases names");
+
+cmp_ok(@names, '==', 3, "got 3 names");