X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=t%2Fprefetch%2Fincomplete.t;h=8682ba784aeb4789edeb2dc4855319916920a6a1;hp=a93e693179c52288ebb70e725061a61010463b77;hb=ce9f555e55e767a287831c0fcccb337cc36905de;hpb=6a0067ea3b9733538c376d0b7b47afef096c8082 diff --git a/t/prefetch/incomplete.t b/t/prefetch/incomplete.t index a93e693..8682ba7 100644 --- a/t/prefetch/incomplete.t +++ b/t/prefetch/incomplete.t @@ -6,8 +6,6 @@ use Test::Exception; use lib qw(t/lib); use DBICTest; -plan tests => 9; - my $schema = DBICTest->init_schema(); lives_ok(sub { @@ -51,3 +49,14 @@ lives_ok(sub { is ($cd->artist->name, 'Random Boy Band', 'Artist object has correct name'); }, 'implicit keyless prefetch works'); + +# sane error +throws_ok( + sub { + $schema->resultset('Track')->search({}, { join => { cd => 'artist' }, '+columns' => 'artist.name' } )->next; + }, + qr|\QCan't inflate manual prefetch into non-existent relationship 'artist' from 'Track', check the inflation specification (columns/as) ending in 'artist.name'|, + 'Sensible error message on mis-specified "as"', +); + +done_testing;