Permalink
Browse files

Merge pull request #109 from iarnell/github108

thanks!
  • Loading branch information...
2 parents 964b335 + 9a09660 commit 2af3dcacf46be358cc1518f6388d97c547b608cf @marcusramberg marcusramberg committed Nov 2, 2012
Showing with 8 additions and 8 deletions.
  1. +6 −6 t/c/email.t
  2. +2 −2 t/c/page_delete.t
View
@@ -17,16 +17,16 @@ my $mech = Test::WWW::Mechanize::Catalyst->new;
my $sender = Email::Sender::Simple->default_transport;
# Clear out emails even though there shouldn't be any yet.
-is( scalar( @{$sender->deliveries} ), 0, 'no mails sent yet' );
+is( () = $sender->deliveries, 0, 'no mails sent yet' );
$mech->get_ok('/.recover_pass');
$mech->submit_form_ok( { fields => { recover => 'admin', }, },
'recover submit' );
-is( scalar( @{$sender->deliveries} ), 1, 'new password emailed' );
+is( () = $sender->deliveries, 1, 'new password emailed' );
# NOTE: The email body content checks are looking for English
-my ($mail) = $sender->deliveries->[0];
+my ($mail) = ($sender->deliveries)[0];
like( $mail->{email}->get_header( 'to' ), qr/^admin/, 'right recipient' );
like( $mail->{email}->get_body, qr/new password/i, 'email contains a new password' );
@@ -37,7 +37,7 @@ ok $schema->resultset('Person')->find({login => 'admin'})->update({pass=>"admin"
# Clear email trap before next test per doc recommendation.
$sender->clear_deliveries;
-is( scalar( @{$sender->deliveries} ), 0, 'email trap reset' );
+is( () = $sender->deliveries, 0, 'email trap reset' );
$mech->get_ok('/.register');
@@ -70,8 +70,8 @@ $mech->submit_form_ok(
# NOTE: This test will fail if the user already exists in t/var/mojomojo.db
# Run: prove --lib /lib t/01app.t to start with fresh database and then run this test.
-is( scalar( @{$sender->deliveries} ), 1, 'registerration validation email sent' );
-($mail) = $sender->deliveries->[0];
+is( () = $sender->deliveries, 1, 'registerration validation email sent' );
+($mail) = ($sender->deliveries)[0];
like( $mail->{email}->get_header('to'), qr/^mojam/, 'right recipient' );
like( $mail->{email}->get_body, qr/validate your email address/i, 'email contains validate email address' );
View
@@ -18,7 +18,7 @@ BEGIN
eval "use WWW::Mechanize::TreeBuilder";
plan skip_all => 'need WWW::Mechanize::TreeBuilder' if $@;
- plan tests => 31;
+ plan tests => 32;
}
use_ok('MojoMojo::Controller::Page');
@@ -106,7 +106,7 @@ ok $mech->click_button(value => 'Yes'), 'click the "Yes" button';
#----------------------------------------------------------------------------
# Search for deleted page
-$mech->post( '/.search',
+$mech->post_ok( '/.search',
{
form_number => 1,
fields => { q => $random }

0 comments on commit 2af3dca

Please sign in to comment.