From 61121788d790da6ee92c045b20f92a1aaabc1df8 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 13 May 2009 03:07:34 +0000 Subject: [PATCH] Fix the logic in t/Asset/Sku.t. Add tests to make sure that the shipsSeparately method is tested. --- t/Asset/Sku.t | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/t/Asset/Sku.t b/t/Asset/Sku.t index a16009acd..e11988107 100644 --- a/t/Asset/Sku.t +++ b/t/Asset/Sku.t @@ -30,7 +30,7 @@ my $session = WebGUI::Test->session; #---------------------------------------------------------------------------- # Tests -plan tests => 19; # Increment this number for each test you create +plan tests => 21; # Increment this number for each test you create #---------------------------------------------------------------------------- # put your tests here @@ -66,8 +66,14 @@ is($sku->getConfiguredTitle, $sku->getTitle, "configured title and title should is($sku->shipsSeparately, 0, 'shipsSeparately return 0 by default'); $sku->update({shipsSeparately => 1,}); -$sku->update({isShippingRequired => 1,}); -is($sku->shipsSeparately, 1, 'shipsSeparately only returns true when isShippingRequired and shipsSeparately'); +is($sku->shipsSeparately, 0, 'shipsSeparately only returns true when isShippingRequired AND shipsSeparately'); + +{ + local *WebGUI::Asset::Sku::isShippingRequired = sub { return 1}; + is($sku->shipsSeparately, 1, 'shipsSeparately only returns true when isShippingRequired AND shipsSeparately'); +} + +ok(! $sku->isShippingRequired, 'Making sure that GLOB is no longer in effect'); isa_ok($sku->getCart, "WebGUI::Shop::Cart", "can get a cart object"); my $item = $sku->addToCart;