aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-06-19 17:13:22 +0100
committerdakkar <dakkar@thenautilus.net>2016-06-19 17:16:28 +0100
commit274617a10bdd958d7e0da3048ce62fb87bfd36a6 (patch)
tree2d3ccfd8453900bd94328241db779afbed9423d9 /t
parentrole: moderate mail from non-subscribers (diff)
downloadSietima-274617a10bdd958d7e0da3048ce62fb87bfd36a6.tar.gz
Sietima-274617a10bdd958d7e0da3048ce62fb87bfd36a6.tar.bz2
Sietima-274617a10bdd958d7e0da3048ce62fb87bfd36a6.zip
::Subscriber now supports aliases
and has a ->match method
Diffstat (limited to 't')
-rw-r--r--t/tests/sietima/subscriber.t46
1 files changed, 33 insertions, 13 deletions
diff --git a/t/tests/sietima/subscriber.t b/t/tests/sietima/subscriber.t
index 1f4c608..5a06bba 100644
--- a/t/tests/sietima/subscriber.t
+++ b/t/tests/sietima/subscriber.t
@@ -6,19 +6,39 @@ use Test2::Bundle::Extended;
use Test2::Plugin::DieOnFail;
use Sietima::Subscriber;
-my $s = Sietima::Subscriber->new(
- raw_address => 'Gino (pino) <gino@pino.example.com>',
-);
+subtest 'simple' => sub {
+ my $s = Sietima::Subscriber->new(
+ raw_address => 'Gino (pino) <gino@pino.example.com>',
+ );
-is(
- $s,
- object {
- call address => 'gino@pino.example.com';
- call name => 'Gino';
- call original => 'Gino (pino) <gino@pino.example.com>';
- call prefs => {};
- },
- 'construction and delegation should work',
-);
+ is(
+ $s,
+ object {
+ call address => 'gino@pino.example.com';
+ call name => 'Gino';
+ call original => 'Gino (pino) <gino@pino.example.com>';
+ call prefs => {};
+ },
+ 'construction and delegation should work',
+ );
+};
+
+subtest 'aliases' => sub {
+ my $s = Sietima::Subscriber->new(
+ raw_address => 'Gino (pino) <gino@pino.example.com>',
+ aliases => [qw(also-gino@pino.example.com maybe-gino@rino.example.com)],
+ );
+
+ is(
+ $s,
+ object {
+ for my $a (qw(gino@pino also-gino@pino maybe-gino@rino)) {
+ call [match => "${a}.example.com"] => T();
+ }
+ },
+ 'all addresses should ->match()',
+ );
+
+};
done_testing;