From: Ash Berlin Date: Wed, 19 Mar 2008 22:31:31 +0000 (+0000) Subject: Tests for error propogation of multi create errors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f10ac17df5c57eb1b559479b7457c6deb1b484a5;p=dbsrgits%2FDBIx-Class-Historic.git Tests for error propogation of multi create errors --- diff --git a/t/96multi_create.t b/t/96multi_create.t index d898563..a6394cf 100644 --- a/t/96multi_create.t +++ b/t/96multi_create.t @@ -194,3 +194,13 @@ is($cd->artist->id, 1, 'rel okay'); my $new_cd = $schema->resultset("CD")->create($new_cd_hashref); is($new_cd->artist->id, 17, 'new id retained okay'); + + +# Make sure exceptions from errors in created rels propogate +eval { + my $t = $schema->resultset("Track")->new({}); + $t->cd($t->new_related('cd', { artist => undef } ) ); + $t->{_rel_in_storage} = 0; + $t->insert; +}; +like($@, qr/cd.artist may not be NULL/, "Exception propogated properly");