diff options
author | dakkar <dakkar@thenautilus.net> | 2016-06-21 16:36:33 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2016-06-21 16:55:21 +0100 |
commit | 34f5eaf6328cf9d6695d5e799e9258aa65c043e4 (patch) | |
tree | adf623270f17437102ccececf0671a6e0a8d78b2 /t/lib/Test | |
parent | Sietima::Message has subscribers as recipients (diff) | |
download | Sietima-34f5eaf6328cf9d6695d5e799e9258aa65c043e4.tar.gz Sietima-34f5eaf6328cf9d6695d5e799e9258aa65c043e4.tar.bz2 Sietima-34f5eaf6328cf9d6695d5e799e9258aa65c043e4.zip |
role: ReplyTo
per-user reply-to munging!
also:
* deliveries_are can now test whole messages
* deliveries_are fails on extra recipients
* easier-to-use Subscriber-from-HashRef coercion
* nomail.t checks more
Diffstat (limited to 't/lib/Test')
-rw-r--r-- | t/lib/Test/Sietima.pm | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/t/lib/Test/Sietima.pm b/t/lib/Test/Sietima.pm index 867fd5a..31fb809 100644 --- a/t/lib/Test/Sietima.pm +++ b/t/lib/Test/Sietima.pm @@ -80,26 +80,56 @@ sub deliveries_are { my (%args) = @_; my $ctx = context(); - my $to = $args{to}; - my @recipients = ref($to) ? $to->@* : $to; - my @deliveries = transport->deliveries; - is( - \@deliveries, - array { - if (@recipients) { + + my $checker; + if (my @mails = ($args{mails}||[])->@*) { + $checker = bag { + for my $m (@mails) { item hash { - field envelope => hash { - field from => $args{from}||$return_path; - field to => bag { - for (@recipients) { - item $_; - } + if (ref($m) eq 'HASH') { + field email => object { + call [cast=>'Email::MIME'] => $m->{o}; }; - }; + field envelope => hash { + field to => bag { + item $_ for $m->{to}->@*; + }; + }; + } + else { + field email => object { + call [cast=>'Email::MIME'] => $m; + }; + } }; } end(); - }, + }; + } + elsif (my @recipients = do {my $to = $args{to}; ref($to) ? $to->@* : $to }) { + $checker = array { + item hash { + field envelope => hash { + field from => $args{from}||$return_path; + field to => bag { + for (@recipients) { + item $_; + } + end(); + }; + }; + }; + end(); + }; + } + else { + $checker = []; + } + + my @deliveries = transport->deliveries; + is( + \@deliveries, + $checker, 'the deliveries should be as expected', np @deliveries, ); |