Lines 191-197
subtest 'create() tests' => sub {
Link Here
|
191 |
|
191 |
|
192 |
subtest 'send_or_die() tests' => sub { |
192 |
subtest 'send_or_die() tests' => sub { |
193 |
|
193 |
|
194 |
plan tests => 4; |
194 |
plan tests => 7; |
195 |
|
195 |
|
196 |
my $email; |
196 |
my $email; |
197 |
my $args; |
197 |
my $args; |
Lines 232-240
subtest 'send_or_die() tests' => sub {
Link Here
|
232 |
); |
232 |
); |
233 |
|
233 |
|
234 |
$THE_email->send_or_die( |
234 |
$THE_email->send_or_die( |
235 |
{ transport => $transport, to => ['tomasito@mail.com'] } ); |
235 |
{ transport => $transport, to => ['tomasito@mail.com'], from => 'returns@example.com' } ); |
236 |
is_deeply( $args->{to}, ['tomasito@mail.com'], |
236 |
is_deeply( $args->{to}, ['tomasito@mail.com'], |
237 |
'If explicitly passed, "to" is preserved' ); |
237 |
'If explicitly passed, "to" is preserved' ); |
|
|
238 |
is( $args->{from}, 'returns@example.com', 'If explicitly pass, "from" is preserved'); |
238 |
|
239 |
|
239 |
$THE_email->send_or_die( { transport => $transport } ); |
240 |
$THE_email->send_or_die( { transport => $transport } ); |
240 |
my @to = sort @{ $args->{to} }; |
241 |
my @to = sort @{ $args->{to} }; |
Lines 247-252
subtest 'send_or_die() tests' => sub {
Link Here
|
247 |
'If "to" is not explicitly passed, extract recipients from headers' |
248 |
'If "to" is not explicitly passed, extract recipients from headers' |
248 |
); |
249 |
); |
249 |
is( $email->header_str('Bcc'), undef, 'The Bcc header is unset' ); |
250 |
is( $email->header_str('Bcc'), undef, 'The Bcc header is unset' ); |
|
|
251 |
my $from = $args->{from}; |
252 |
is( $from, 'sender@example.com', 'If "from" is not explicitly passed, extract from Sender header' ); |
253 |
is( $email->header_str('Sender'), undef, 'The Sender header is unset' ); |
250 |
}; |
254 |
}; |
251 |
|
255 |
|
252 |
subtest 'is_valid' => sub { |
256 |
subtest 'is_valid' => sub { |
253 |
- |
|
|