aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/develop.t
blob: 92aa86721e5704c82f282f40ba44538e9cf7fb35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use FixMyStreet::TestMech;

ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );

my ($problem) = $mech->create_problems_for_body(1, 2504, 'title');
my $update = $mech->create_comment_for_problem($problem, $problem->user, 'Name', 'Text', 'f', 'confirmed', 'confirmed');

subtest 'not visible on live site' => sub {
    FixMyStreet::override_config {
        STAGING_SITE => 0
    }, sub {
        $mech->get('/_dev/email/');
        is $mech->res->code, 404;
        $mech->get('/_dev/email/login');
        is $mech->res->code, 404;
    };
};

subtest 'dev email index page' => sub {
    $mech->get_ok('/_dev/email/');
    $mech->content_contains('login">login</a></li>');
    $mech->content_contains('questionnaire?problem=' . $problem->id  . '">questionnaire</a></li>');
    $mech->content_contains('update-confirm?update=' . $update->id . '">update-confirm</a></li>');
};

subtest 'individual email previews' => sub {
    $mech->get_ok('/_dev/email/alert-problem-area');
    $mech->get_ok('/_dev/email/alert-update?problem=' . $problem->id);
    $mech->get_ok('/_dev/email/questionnaire?problem=' . $problem->id);
    $mech->get_ok('/_dev/email/update-confirm?update=' . $update->id);
};

done_testing();