X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F46where_attribute.t;fp=t%2F46where_attribute.t;h=0fedbe7b32fee3ae2a94056d0f35d1c72c00d5fd;hb=7305f6f933813eaa1a4a7b65bfc5f158d0d65c4d;hp=ba1c7d09ebaf631099b7f25c3ca4cc173250619d;hpb=3aa25d8b47104964c689be4ca8c1fc5b17781a7f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/46where_attribute.t b/t/46where_attribute.t index ba1c7d0..0fedbe7 100644 --- a/t/46where_attribute.t +++ b/t/46where_attribute.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; +use Test::Warn; use DBICTest; my $schema = DBICTest->init_schema(); @@ -22,9 +23,12 @@ is($programming_perl->id, 1, 'select from a resultset with find_or_create for ex # and inserts? my $see_spot; -$see_spot = eval { $owner->books->find_or_create({ title => "See Spot Run" }) }; -if ($@) { print $@ } -ok(!$@, 'find_or_create on resultset with attribute for non-existent entry did not throw'); +$see_spot = eval { + warnings_exist { + $owner->books->find_or_create({ title => "See Spot Run" }) + } qr/Missing value for primary key column 'id' on BooksInLibrary - perhaps you forgot to set its 'is_auto_increment'/; +}; +is ($@, '', 'find_or_create on resultset with attribute for non-existent entry did not throw'); ok(defined $see_spot, 'successfully did insert on resultset with attribute for non-existent entry'); my $see_spot_rs = $owner->books->search({ title => "See Spot Run" });