Restore ability to handle underdefined root (t/prefetch/incomplete.t)
[dbsrgits/DBIx-Class.git] / t / 19retrieve_on_insert.t
CommitLineData
8b9473f5 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Exception;
6use lib qw(t/lib);
7use DBICTest;
8
9my $schema = DBICTest->init_schema();
10$schema->storage->sql_maker->quote_char('"');
11
12my $rs = $schema->resultset ('Artist');
13
14my $obj;
15lives_ok { $obj = $rs->create ({ name => 'artistA' }) } 'Default insert successful';
16is ($obj->rank, undef, 'Without retrieve_on_insert, check rank');
17
18$rs->result_source->add_columns(
19 '+rank' => { retrieve_on_insert => 1 }
20);
21
22lives_ok { $obj = $rs->create ({ name => 'artistB' }) } 'Default insert successful';
23is ($obj->rank, 13, 'With retrieve_on_insert, check rank');
24
25done_testing;