$savings_account = BankAccount->new( balance => 250 );
isa_ok( $savings_account, 'BankAccount' );
- is( $savings_account->balance, 250, '... got the right savings balance' );
+ is( $savings_account->balance, 250, 'got the right savings balance' );
lives_ok {
$savings_account->withdraw(50);
}
- '... withdrew from savings successfully';
+ 'withdrew from savings successfully';
is( $savings_account->balance, 200,
- '... got the right savings balance after withdrawl' );
+ 'got the right savings balance after withdrawl' );
$savings_account->deposit(150);
is( $savings_account->balance, 350,
- '... got the right savings balance after deposit' );
+ 'got the right savings balance after deposit' );
}
{
isa_ok( $checking_account, 'BankAccount' );
is( $checking_account->overdraft_account, $savings_account,
- '... got the right overdraft account' );
+ 'got the right overdraft account' );
is( $checking_account->balance, 100,
- '... got the right checkings balance' );
+ 'got the right checkings balance' );
lives_ok {
$checking_account->withdraw(50);
}
- '... withdrew from checking successfully';
+ 'withdrew from checking successfully';
is( $checking_account->balance, 50,
- '... got the right checkings balance after withdrawl' );
+ 'got the right checkings balance after withdrawl' );
is( $savings_account->balance, 350,
- '... got the right savings balance after checking withdrawl (no overdraft)'
+ 'got the right savings balance after checking withdrawl (no overdraft)'
);
lives_ok {
$checking_account->withdraw(200);
}
- '... withdrew from checking successfully';
+ 'withdrew from checking successfully';
is( $checking_account->balance, 0,
- '... got the right checkings balance after withdrawl' );
+ 'got the right checkings balance after withdrawl' );
is( $savings_account->balance, 200,
- '... got the right savings balance after overdraft withdrawl' );
+ 'got the right savings balance after overdraft withdrawl' );
}
{
isa_ok( $checking_account, 'BankAccount' );
is( $checking_account->overdraft_account, undef,
- '... no overdraft account' );
+ 'no overdraft account' );
is( $checking_account->balance, 100,
- '... got the right checkings balance' );
+ 'got the right checkings balance' );
lives_ok {
$checking_account->withdraw(50);
}
- '... withdrew from checking successfully';
+ 'withdrew from checking successfully';
is( $checking_account->balance, 50,
- '... got the right checkings balance after withdrawl' );
+ 'got the right checkings balance after withdrawl' );
dies_ok {
$checking_account->withdraw(200);
}
- '... withdrawl failed due to attempted overdraft';
+ 'withdrawl failed due to attempted overdraft';
is( $checking_account->balance, 50,
- '... got the right checkings balance after withdrawl failure' );
+ 'got the right checkings balance after withdrawl failure' );
}
=end testing