Fix incorrect placement of condition resolution failure trap
[dbsrgits/DBIx-Class.git] / t / relationship / unresolvable.t
diff --git a/t/relationship/unresolvable.t b/t/relationship/unresolvable.t
new file mode 100644 (file)
index 0000000..5a53cd9
--- /dev/null
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+
+my $cd = $schema->resultset('CD')->search ({}, { columns => ['year'], rows => 1 })->single;
+
+
+throws_ok (
+  sub { $cd->tracks },
+  qr/Unable to resolve relationship .+ column .+ not loaded from storage/,
+  'Correct exception on nonresolvable object-based condition'
+);
+
+done_testing;