use strict;
use warnings;
use lib 't/lib';
-use Test::More qw(no_plan);
+use Test::More tests => 5;
use Test::Exception;
-use Devel::Dwarn;
+use NoSequenceSalad;
BEGIN {
- use_ok 'NoSequence';
$ENV{DBIC_TRACE} = 0;
}
-
my ( $dsn, $user, $pass )
= @ENV{ map {"DBICTEST_PG_${_}"} qw/DSN USER PASS/ };
( NOTE: This test drops and creates some tables.')
EOM
-my $schema = NoSequence->connect( $dsn, $user, $pass );
-$schema->storage->dbh->{Warn} = 0;
+my $schema = NoSequenceSalad->connect( $dsn, $user, $pass );
$schema->storage->ensure_connected;
+$schema->storage->dbh->{Warn} = 0;
$schema->storage->_use_insert_returning(0);
my $dir = "t/sql"; # tempdir(CLEANUP => 0);
$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir );
-$schema->deploy( { add_drop_table => 1, add_drop_view => 1 } );
+
+lives_ok { $schema->deploy( { add_drop_table => 1, add_drop_view => 1 } ) }
+"I can deploy the schema";
isa_ok(
$schema->source('Mesclun'),
lives_ok {
$bowl_of_salad = $schema->resultset('Mesclun')
- ->create( { acidity => 4, spiciness => '10', fresh => 0 } );
+ ->create( { acidity => 4, spiciness => '10', fresh => 0, } );
}
"I can call a create on a view mesclun";
}
"I can do it for the other view, too";
+my $sqlt_object = $schema->{sqlt};
+
+is_deeply(
+ [ map { $_->name } $sqlt_object->get_views ],
+ [ qw/
+ salad
+ mesclun
+ /
+ ],
+ "SQLT view order triumphantly matches our order."
+);