--- /dev/null
+package Newslash::Util::TestMan::Mail;
+
+use strict;
+use warnings;
+use utf8;
+use feature ':5.10';
+use Exporter 'import';
+
+use Test::More;
+use Data::Dumper;
+
+sub new {
+ my ($class, $mail, $options) = @_;
+ $options ||= {};
+ bless {
+ options => $options,
+ mail => $mail,
+ last_match => {},
+ }, $class;
+}
+
+sub mail { return shift->{mail}; }
+sub body { return shift->mail->{body} };
+sub to { return shift->mail->{to} };
+
+sub to_is {
+ my ($self, $address, $message) = @_;
+ is($self->to, $address, $message);
+ return $self;
+}
+
+sub body_matches {
+ my ($self, $regex, $message) = @_;
+ ok($self->body =~ $regex, $message);
+ $self->{last_match} = {%+};
+ return $self;
+}
+
+sub last_match {
+ return shift->{last_match};
+}
+
+
+1;