X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdelete%2Fcomplex.t;h=149bcf1d28a736e85040b917484610918a56fd41;hb=4b0a90fd521969ffded3f6cfe9fea95078326b07;hp=50573917a2f63e2487025125b55825215d1edb47;hpb=037e8dca0dd1700345e2a36f78b399b59b8de99a;p=dbsrgits%2FDBIx-Class.git diff --git a/t/delete/complex.t b/t/delete/complex.t index 5057391..149bcf1 100644 --- a/t/delete/complex.t +++ b/t/delete/complex.t @@ -11,25 +11,30 @@ my $artist_rs = $schema->resultset ('Artist'); my $init_count = $artist_rs->count; ok ($init_count, 'Some artists is database'); -$artist_rs->populate ([ - { - name => 'foo', - }, - { - name => 'bar', - } -]); - -is ($artist_rs->count, $init_count + 2, '2 Artists created'); - -$artist_rs->search ({ - -and => [ - { 'me.artistid' => { '!=', undef } }, +foreach my $delete_arg ( [ { 'me.name' => 'foo' }, { 'me.name' => 'bar' } ], - ], -})->delete; - -is ($artist_rs->count, $init_count, 'Correct amount of artists deleted'); + [ 'me.name' => 'foo', 'me.name' => 'bar' ], +) { + $artist_rs->populate ([ + { + name => 'foo', + }, + { + name => 'bar', + } + ]); + + is ($artist_rs->count, $init_count + 2, '2 Artists created'); + + $artist_rs->search ({ + -and => [ + { 'me.artistid' => { '!=', undef } }, + $delete_arg, + ], + })->delete; + + is ($artist_rs->count, $init_count, 'Correct amount of artists deleted'); +} done_testing;