X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FCookbook%2FBasics%2FRecipe2.pod;h=abb50ec1e8cbc16ba80f3f47d03084c32a07a3b2;hb=b10dde3a27c11623547417c599ccbd4f92e42651;hp=9f1a4dd2659e605de86ccccf3ef9a1bbd85fd8f2;hpb=d4e538d9bf46d1c14d2ecfd36ac35ed541ae7ee6;p=gitmo%2FMoose.git diff --git a/lib/Moose/Cookbook/Basics/Recipe2.pod b/lib/Moose/Cookbook/Basics/Recipe2.pod index 9f1a4dd..abb50ec 100644 --- a/lib/Moose/Cookbook/Basics/Recipe2.pod +++ b/lib/Moose/Cookbook/Basics/Recipe2.pod @@ -236,10 +236,13 @@ my $savings_account; isa_ok( $savings_account, 'BankAccount' ); is( $savings_account->balance, 250, '... got the right savings balance' ); - lives_ok { - $savings_account->withdraw(50); - } - '... withdrew from savings successfully'; + is( + exception { + $savings_account->withdraw(50); + }, + undef, + '... withdrew from savings successfully' + ); is( $savings_account->balance, 200, '... got the right savings balance after withdrawl' ); @@ -262,20 +265,26 @@ my $savings_account; is( $checking_account->balance, 100, '... got the right checkings balance' ); - lives_ok { - $checking_account->withdraw(50); - } - '... withdrew from checking successfully'; + is( + exception { + $checking_account->withdraw(50); + }, + undef, + '... withdrew from checking successfully' + ); is( $checking_account->balance, 50, '... got the right checkings balance after withdrawl' ); is( $savings_account->balance, 350, '... got the right savings balance after checking withdrawl (no overdraft)' ); - lives_ok { - $checking_account->withdraw(200); - } - '... withdrew from checking successfully'; + is( + exception { + $checking_account->withdraw(200); + }, + undef, + '... withdrew from checking successfully' + ); is( $checking_account->balance, 0, '... got the right checkings balance after withdrawl' ); is( $savings_account->balance, 200, @@ -297,17 +306,23 @@ my $savings_account; is( $checking_account->balance, 100, '... got the right checkings balance' ); - lives_ok { - $checking_account->withdraw(50); - } - '... withdrew from checking successfully'; + is( + exception { + $checking_account->withdraw(50); + }, + undef, + '... withdrew from checking successfully' + ); is( $checking_account->balance, 50, '... got the right checkings balance after withdrawl' ); - dies_ok { - $checking_account->withdraw(200); - } - '... withdrawl failed due to attempted overdraft'; + isnt( + exception { + $checking_account->withdraw(200); + }, + undef, + '... withdrawal failed due to attempted overdraft' + ); is( $checking_account->balance, 50, '... got the right checkings balance after withdrawl failure' ); }