Tidy tests
[dbsrgits/DBIx-Class-ResultSource-MultipleTableInheritance.git] / t / 03insert.t
CommitLineData
2c296bdb 1use strict;
2use warnings;
3use lib 't/lib';
4use Test::More qw(no_plan);
5use Test::Exception;
6use Devel::Dwarn;
7
8BEGIN {
9 use_ok 'Cafe';
ebcd7e95 10 $ENV{DBIC_TRACE} = 0;
2c296bdb 11}
12
ebcd7e95 13my $schema = Cafe->connect( 'dbi:Pg:dbname=test', 'postgres', '' );
14$schema->storage->dbh->{Warn} = 0;
2c296bdb 15$schema->storage->ensure_connected;
16$schema->storage->_use_insert_returning(0);
ebcd7e95 17
18my $dir = "t/sql"; # tempdir(CLEANUP => 0);
19$schema->create_ddl_dir( ['PostgreSQL'], 0.1, $dir );
20$schema->deploy( { add_drop_table => 1, add_drop_view => 1 } );
21
2c296bdb 22isa_ok(
23 $schema->source('Sumatra'),
24 'DBIx::Class::ResultSource::View',
25 "My MTI class also"
26);
27
28my ( $drink, $drink1 );
29
30lives_ok {
31 $drink = $schema->resultset('Sumatra')
32 ->create( { sweetness => 4, aroma => 'earthy', flavor => 'great' } );
33}
34"I can call a create on a view sumatra";
35
36lives_ok {
37 $drink1 = $schema->resultset('Coffee')->create( { flavor => 'aaight', } );
38}
39"I can do it for the other view, too";