[Bast-commits] r8350 - in
DBIx-Class/0.08/branches/dbicadmin_refactor: lib/DBIx/Class t/admin
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Sun Jan 17 21:41:11 GMT 2010
Author: ribasushi
Date: 2010-01-17 21:41:11 +0000 (Sun, 17 Jan 2010)
New Revision: 8350
Modified:
DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm
DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/01load.t
DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/02ddl.t
Log:
More tets cleanup
Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm 2010-01-17 21:33:12 UTC (rev 8349)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm 2010-01-17 21:41:11 UTC (rev 8350)
@@ -250,7 +250,7 @@
sub _build_config {
my ($self) = @_;
- try { require 'Config::Any'; } catch { die "Config::Any is required to parse the config file"; };
+ try { require Config::Any } catch { die "Config::Any is required to parse the config file"; };
my $cfg = Config::Any->load_files ( {files => [$self->config_file], use_ext =>1, flatten_to_hash=>1});
@@ -411,7 +411,7 @@
print "retun is $ret\n";
}
elsif ($schema->get_db_version() and $self->force ) {
- warn "forcing install may not be a good idea";
+ warn "Forcing install may not be a good idea";
if($self->_confirm() ) {
# FIXME private api
$self->schema->_set_db_version({ version => $version});
Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/01load.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/01load.t 2010-01-17 21:33:12 UTC (rev 8349)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/01load.t 2010-01-17 21:41:11 UTC (rev 8350)
@@ -17,17 +17,9 @@
use strict;
use warnings;
-use Test::More; # last test to print
+use Test::More;
-use FindBin qw($Bin);
-use Path::Class;
-
-use lib dir($Bin,'..', '..','lib')->stringify;
-use lib dir($Bin,'..', 'lib')->stringify;
-
-
-
BEGIN {
eval "use DBIx::Class::Admin";
plan skip_all => "Deps not installed: $@" if $@;
Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/02ddl.t
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/02ddl.t 2010-01-17 21:33:12 UTC (rev 8349)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/t/admin/02ddl.t 2010-01-17 21:41:11 UTC (rev 8350)
@@ -17,28 +17,26 @@
use strict;
use warnings;
-use Test::More; # last test to print
-
+use Test::More;
use Test::Exception;
+use Test::Warn;
BEGIN {
- use FindBin qw($Bin);
- use File::Spec::Functions qw(catdir);
- use lib catdir($Bin,'..', '..','lib');
- use lib catdir($Bin,'..', 'lib');
-
eval "use DBIx::Class::Admin";
plan skip_all => "Deps not installed: $@" if $@;
}
+
+use lib qw(t/lib);
+use DBICTest;
+
use Path::Class;
use ok 'DBIx::Class::Admin';
-use DBICTest;
-my $sql_dir = dir($Bin,"..","var");
+my $sql_dir = dir(qw/t var/);
my @connect_info = DBICTest->_database(
no_deploy=>1,
no_populate=>1,
@@ -92,7 +90,7 @@
$admin = DBIx::Class::Admin->new(
schema_class => 'DBICVersion::Schema',
- sql_dir => "t/var",
+ sql_dir => $sql_dir,
connect_info => \@connect_info
);
@@ -100,7 +98,10 @@
# sleep required for upgrade table to hold a distinct time of upgrade value
# otherwise the returned of get_db_version can be undeterministic
sleep 1;
-lives_ok {$admin->upgrade();} 'upgrade the schema';
+{
+ local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /DB version .+? is lower than the schema version/ };
+ lives_ok {$admin->upgrade();} 'upgrade the schema';
+}
is($schema->get_db_version, $DBICVersion::Schema::VERSION, 'Schema and db versions match');
@@ -123,13 +124,15 @@
dies_ok { $admin->install("4.0"); } 'cannot install to allready existing version';
sleep 1;
$admin->force(1);
-lives_ok { $admin->install("4.0"); } 'can force install to allready existing version';
+warnings_exist ( sub {
+ lives_ok { $admin->install("4.0") } 'can force install to allready existing version'
+}, qr/Forcing install may not be a good idea/, 'Force warning emitted' );
is($admin->schema->get_db_version, "4.0", 'db thinks its version 4.0');
#clean_dir($sql_dir);
}
sub clean_dir {
- my ($dir) =@_;
+ my ($dir) = @_;
$dir = $dir->resolve;
if ( ! -d $dir ) {
$dir->mkpath();
More information about the Bast-commits
mailing list