9 use aliased 'Promulger::List';
10 # no alias here so we don't risk colliding with perl's own Config.pm -- apeiron,
12 use Promulger::Config;
15 my $raw_pmg_home = File::Temp->newdir;
16 my $pmg_home = dir($raw_pmg_home);
18 my $aliases = $pmg_home->file('aliases');
19 my $aliases_fh = $aliases->openw;
22 my $list_home = $pmg_home->subdir('lists');
25 my $config_file = $pmg_home->file('pmg.conf');
26 my $config_fh = $config_file->openw;
27 print $config_fh <<"CONFIG";
30 list_home = $list_home
34 my $config = Promulger::Config->load_config($config_file);
36 lives_ok { $list = List->new(
40 ) } "can create a list";
41 lives_ok { $list->setup } "can setup a list";
47 "list has same listname as one we specified",
53 "list is active, like the one we specified",
58 "list has no subscribers for now, like the one we specified",
61 my $resolved_list = List->resolve('foo');
63 $resolved_list->listname,
66 "resolved list has same listname as one we created",
69 $resolved_list->active,
72 "resolved list is active, like the one we created",
75 $resolved_list->subscribers,
77 "resolved list has no subscribers for now, like the one we created",
80 lives_ok { $list->subscribe('foo@example.com') } "can subscribe someone";
81 $list = List->resolve('foo');
85 'foo@example.com' => 1,
87 "subscribing a user adds them to the serialized data",
89 lives_ok { $list->unsubscribe('foo@example.com') } "can unsubscribe someone";
90 $list = List->resolve('foo');
94 "unsubscribing a user removes them from the serialized data",