fixes https://rt.cpan.org/Ticket/Display.html?id=74086
[dbsrgits/DBIx-Class-InflateColumn-Object-Enum.git] / t / regres / rt_74086.t
diff --git a/t/regres/rt_74086.t b/t/regres/rt_74086.t
new file mode 100644 (file)
index 0000000..27646c0
--- /dev/null
@@ -0,0 +1,28 @@
+use Test::More 'no_plan';
+
+BEGIN {
+    use lib 't/lib';
+    use_ok 'DBICx::TestDatabase';
+    use_ok 'TestDB';
+    use_ok 'Try::Tiny';
+}
+
+my $db = DBICx::TestDatabase->new('TestDB');
+
+isa_ok $db, 'TestDB';
+
+my $rs = $db->resultset('VarcharEnumNoneNullable')
+            ->create({id => 1, enum => 'red'});
+
+ok defined($rs) && $rs, 'got a resultset'
+    or diag "ResultSet: $rs";
+
+try {
+    $rs->enum('pink');
+    $rs->enum; # trigger inflator
+} catch {
+    ok 1, "Throws an exception: $_"
+} finally {
+    ok 0, 'Does not throw an exception' unless @_;
+}
+