X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F96multi_create.t;h=356aae65a9d33c55d51bcce5ac4b21663ddd96dd;hb=f34cb1fdd136d65352df8757b6de7686ad3b84e5;hp=a6394cf7b6c62b94494fabb9767a509a5cc85ff0;hpb=f10ac17df5c57eb1b559479b7457c6deb1b484a5;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/96multi_create.t b/t/96multi_create.t index a6394cf..356aae6 100644 --- a/t/96multi_create.t +++ b/t/96multi_create.t @@ -196,6 +196,19 @@ my $new_cd = $schema->resultset("CD")->create($new_cd_hashref); is($new_cd->artist->id, 17, 'new id retained okay'); +# Test find or create related functionality +my $new_artist = $schema->resultset("Artist")->create({ artistid => 18, name => 'larry' }); + +eval { + $schema->resultset("CD")->create({ + cdid => 28, + title => 'Boogie Wiggle', + year => '2007', + artist => { artistid => 18, name => 'larry' } + }); +}; +is($@, '', 'new cd created without clash on related artist'); + # Make sure exceptions from errors in created rels propogate eval { my $t = $schema->resultset("Track")->new({});