aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/contact.t
blob: 60e330776beed4e903623d25060d1cdca57b520a (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use strict;
use warnings;
use Test::More;

use FixMyStreet::TestMech;

my $mech = FixMyStreet::TestMech->new;


$mech->get_ok( '/contact' );
$mech->title_like( qr/Contact Us/ );
$mech->content_contains( "We'd love to hear what you think about this site" );

subtest 'check reporting a problem displays correctly' => sub {
    my $user = FixMyStreet::App->model('DB::User')->find_or_create(
        {
            name  => 'A User',
            email => 'problem_report_rest@example.com'
        }
    );

    my $problem = FixMyStreet::App->model('DB::Problem')->create(
        {
            title => 'Some problem or other',
            detail => 'More detail on the problem',
            postcode => 'EH99 1SP',
            latitude => 0,
            longitude => 0,
            areas => 0,
            used_map => 0,
            name => 'Problem User',
            anonymous => 0,
            state => 'confirmed',
            user    => $user
        }
    );

    ok $problem, 'succesfully create a problem';

    $mech->get_ok( '/contact?id=' . $problem->id );
    $mech->content_contains( 'reporting the following problem' );
    $mech->content_contains( 'Some problem or other' );
    $mech->content_contains( 'Reported by A User' );

    $problem->delete;
};

done_testing();