Nobuo Danjou > Email-Send-Test-DataDumper-0.01 > Email::Send::Test::DataDumper

Download:
Email-Send-Test-DataDumper-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Email::Send::Test::DataDumper - Captures emails sent via Email::Send for testing, with Tie::DataDumper

SYNOPSIS ^

  # Load as normal
  use Email::Send;
  use Email::Send::Test::DataDumper;

  # First, set the filename for Tie::DataDumper
  $Email::Send::Test::DataDumper::FILENAME = 'sentmail.txt';

  # Always clear the email trap before each test to prevent unexpected
  # results, and thus spurious test results.
  Email::Send::Test::DataDumper->clear;
  
  ### BEGIN YOUR CODE TO BE TESTED (example follows)
  my $sender = Email::Send->new({ mailer => 'Test::DataDumper', mailer_args => [ 'sentmail.txt' ] });
  $sender->send( $message );
  ### END YOUR CODE TO BE TESTED
  
  # Check that the number and type (and content) of mails
  # matched what you expect.
  my @emails = Email::Send::Test::DataDumper->emails;
  is( scalar(@emails), 1, 'Sent 1 email' );
  isa_ok( $emails[0], 'Email::MIME' ); # Email::Simple subclasses pass through

DESCRIPTION ^

Email::Send::Test::DataDumper is

AUTHOR ^

Nobuo Danjou <nobuo.danjou@gmail.com>

SEE ALSO ^

Email::Send::Test, Tie::DataDumper

LICENSE ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: