Moosse All Clean
Test post-ette day again here in the Moose-pen
Today just a quick test clean up for Database::Accessor, since I made quite a few changes to it over the past few days mostly making elements a required field and validating that it is not an empty array.
On my first run I got a whole bunch of these;
Attribute (elements) is required at …
in the following test cases,
t/30_view.t
t/31_elements.t
t/43_dynamic_conditions.t
t/45_dynamic_links.t
t/47_dynamic_gathers.t
t/49_dynamic_sorts.t
t/60_env_vars.t
which just means I have to update my tests so that the hash that is used to create the Database::Accessor has a non empty array. So after a good 20 mins cutting and pasting here and there I cleaned up those tests and now I only have these little fails;
...
# Failed test 'none on delete'
# at t/31_elements.t line 91.
# Looks like you failed 1 test of 31.
...
t/39_sorts.t ................ 1/11
# Failed test 'No Sorts on create'
# at t/39_sorts.t line 74.
# Failed test 'No Sorts on update'
# at t/39_sorts.t line 74.
# Failed test 'No Sorts on delete'
# at t/39_sorts.t line 74.
# Looks like you failed 3 tests of 11.
…
All of these are related to the decision to always send down the elements and sorts to the DAD no matter what the action is so all I need to do for the first fail is;
– ok($dad->element_count == 0,"none on delete");
++ ok($dad->element_count == 3,"three on delete");
and on the second set of fails I just need to adjust the count again;
foreach my $type (qw(create update delete)){
$da->$type( Data::Test->new(), {test=>1} );
$dad = $da->result->error(); #note to others this is a kludge for testing
-- ok($dad->sort_count ==0, "No Sorts on $type");
++ ok($dad->sort_count ==3, "correct Sort count on $type");
}
to get all of those tests to pass.
Now when I run the test suite I get
All tests successful.
Files=29, Tests=452, ...
Result: PASS
Onward!
Leave a comment