Release 0.02
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / t / 04no_sequence_defined.t
index d210d69..336891c 100644 (file)
@@ -1,15 +1,13 @@
 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/ };
 
@@ -18,14 +16,16 @@ Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test
 ( 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'),
@@ -37,7 +37,7 @@ my ( $bowl_of_salad, $bowl_of_salad1 );
 
 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";
 
@@ -46,3 +46,14 @@ lives_ok {
 }
 "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."
+);