Commit | Line | Data |
2c296bdb |
1 | use strict; |
2 | use warnings; |
3 | use lib 't/lib'; |
4 | use Test::More qw(no_plan); |
5 | use Test::Exception; |
6 | use Devel::Dwarn; |
7 | |
8 | BEGIN { |
9 | use_ok 'Cafe'; |
ebcd7e95 |
10 | $ENV{DBIC_TRACE} = 0; |
2c296bdb |
11 | } |
12 | |
ebcd7e95 |
13 | my $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 | |
18 | my $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 |
22 | isa_ok( |
23 | $schema->source('Sumatra'), |
24 | 'DBIx::Class::ResultSource::View', |
25 | "My MTI class also" |
26 | ); |
27 | |
28 | my ( $drink, $drink1 ); |
29 | |
30 | lives_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 | |
36 | lives_ok { |
37 | $drink1 = $schema->resultset('Coffee')->create( { flavor => 'aaight', } ); |
38 | } |
39 | "I can do it for the other view, too"; |
e96b2eeb |
40 | |
41 | |