27646c00f0ae03912f5a672323f157829e41b0b5
[dbsrgits/DBIx-Class-InflateColumn-Object-Enum.git] / t / regres / rt_74086.t
1 use Test::More 'no_plan';
2
3 BEGIN {
4     use lib 't/lib';
5     use_ok 'DBICx::TestDatabase';
6     use_ok 'TestDB';
7     use_ok 'Try::Tiny';
8 }
9
10 my $db = DBICx::TestDatabase->new('TestDB');
11
12 isa_ok $db, 'TestDB';
13
14 my $rs = $db->resultset('VarcharEnumNoneNullable')
15             ->create({id => 1, enum => 'red'});
16
17 ok defined($rs) && $rs, 'got a resultset'
18     or diag "ResultSet: $rs";
19
20 try {
21     $rs->enum('pink');
22     $rs->enum; # trigger inflator
23 } catch {
24     ok 1, "Throws an exception: $_"
25 } finally {
26     ok 0, 'Does not throw an exception' unless @_;
27 }
28