aboutsummaryrefslogtreecommitdiff
path: root/t/tests/sietima/role/debounce.t
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-06-19 18:22:14 +0100
committerdakkar <dakkar@thenautilus.net>2016-06-19 18:22:14 +0100
commit1ea33ee05cc3f681be561c6a0b9f87846406c24a (patch)
treeabac91e193385901adccdd42c335c22210184ec2 /t/tests/sietima/role/debounce.t
parentAvoidDups role (diff)
downloadSietima-1ea33ee05cc3f681be561c6a0b9f87846406c24a.tar.gz
Sietima-1ea33ee05cc3f681be561c6a0b9f87846406c24a.tar.bz2
Sietima-1ea33ee05cc3f681be561c6a0b9f87846406c24a.zip
Debounce role
Diffstat (limited to 't/tests/sietima/role/debounce.t')
-rw-r--r--t/tests/sietima/role/debounce.t45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/tests/sietima/role/debounce.t b/t/tests/sietima/role/debounce.t
new file mode 100644
index 0000000..6021f2b
--- /dev/null
+++ b/t/tests/sietima/role/debounce.t
@@ -0,0 +1,45 @@
+#!perl
+use strict;
+use warnings;
+use 5.020;
+use lib 't/lib';
+use Test::Sietima;
+
+my $s = make_sietima(
+ with_traits => ['Debounce'],
+ subscribers => [
+ 'one@users.example.com',
+ 'two@users.example.com',
+ ],
+);
+
+test_sending(
+ sietima => $s,
+);
+
+my $return_path = $s->return_path->address;
+
+is(
+ [ transport->deliveries ],
+ array {
+ item hash {
+ field email => object {
+ call [cast=>'Email::MIME'] => object {
+ call [ header_str => 'X-Been-There' ] =>
+ match qr{\b\Q$return_path\E\b};
+ };
+ };
+ };
+ },
+ 'header should be added to all messages',
+);
+
+test_sending(
+ sietima => $s,
+ mail => {
+ headers => { 'x-been-there' => $return_path },
+ },
+ to => [],
+);
+
+done_testing;