App-Dochazka-Common
view release on metacpan or search on metacpan
t/model/reset.t view on Meta::CPAN
note( 'attempt to spawn a hooligan' );
like( exception { $full_class->spawn( 'hooligan' => 'sneaking in' ); },
qr/not listed in the validation options: hooligan/ );
note('spawn testing object' );
my $testobj = $full_class->spawn( %{ $props_dispatch{$cl} } );
note( 'reset it' );
$testobj->reset;
note( 'verify that we have all the properties right' );
foreach my $prop ( @{ $full_class->attrs } ) {
note( "Property $prop" );
ok( exists( $props_dispatch{$cl}->{$prop} ) );
}
my %attrs;
map { $attrs{$_} = ''; } @{ $full_class->attrs };
foreach my $prop ( keys( %{ $props_dispatch{$cl} } ) ) {
ok( exists( $attrs{$prop} ) );
}
note( 'verify that all properties have been set to undef' );
foreach my $prop ( @{ $full_class->attrs } ) {
is( $testobj->{$prop}, undef );
}
}
done_testing;
( run in 0.452 second using v1.01-cache-2.11-cpan-13bb782fe5a )