Change the generic tax driver to remove spaces around commas when adding a new row. Add tests and a convenience method for getting one line of tax information. Upgrade sub fixes any information already in the db.

This commit is contained in:
Colin Kuskie 2011-06-30 14:07:36 -07:00
parent 6ac46be8bd
commit 2bcda0c9f5
5 changed files with 69 additions and 7 deletions

View file

@ -38,10 +38,10 @@ $session->user({userId => 3});
my $addExceptions = getAddExceptions($session);
my $tests = 79 + 2*scalar(@{$addExceptions});
my $tests = 80 + 2*scalar(@{$addExceptions});
plan tests => $tests;
WebGUI::Test->addToCleanup(SQL => 'delete from tax_generic_rates');
#WebGUI::Test->addToCleanup(SQL => 'delete from tax_generic_rates');
#----------------------------------------------------------------------------
# put your tests here
@ -147,6 +147,30 @@ my $dupId = $taxer->add($taxData);
$taxIterator = $taxer->getItems;
is($taxIterator->rows, 3, 'add permits adding duplicate information.');
my $spaceId = $taxer->add({
country => 'USA, United States , United States Of America ,U.S.A',
state => 'Wisconsin, WI',
city => 'MADCITY, madcity, Madison , WebGUIVille',
code => '77575, 54703 , 97424',
taxRate => '7.77',
});
my $no_spaces = $taxer->getItem($spaceId);
cmp_deeply (
$no_spaces,
{
country => 'USA,United States,United States Of America,U.S.A',
state => 'Wisconsin,WI',
city => 'MADCITY,madcity,Madison,WebGUIVille',
taxRate => '7.77',
taxId => $spaceId,
code => '77575,54703,97424',
},
'Spaces removed from content when adding'
);
$taxer->delete({taxId => $spaceId});
##Madison zip codes:
##53701-53709
##city rate: 0.5%