aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorpezholio <pezholio@gmail.com>2017-02-07 16:17:15 +0000
committerpezholio <pezholio@gmail.com>2017-05-05 10:24:56 +0100
commit1c07eca3d6e8cea5d70c043de02d30bd7cdc5630 (patch)
tree8da5fcef1f135939697a48199c040955d5f4acc0 /t
parent5915c45b6cc4b1d565646a07a77dfce9a9e2354f (diff)
Redirect to report for inspectors
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_new.t42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 71090cd26..f3bee0513 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1635,6 +1635,48 @@ subtest "extra google analytics code displayed on email confirmation problem cre
};
};
+subtest "inspectors get redirected directly to the report page" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ { fixmystreet => '.' } ],
+ BASE_URL => 'https://www.fixmystreet.com',
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ }, sub {
+ $mech->log_out_ok;
+
+ my $user = $mech->create_user_ok('inspector@example.org', name => 'inspector', from_body => $bodies[0]);
+ $user->user_body_permissions->find_or_create({
+ body => $bodies[0],
+ permission_type => 'planned_reports',
+ });
+
+ $mech->log_in_ok('inspector@example.org');
+ $mech->get_ok('/');
+ $mech->submit_form_ok( { with_fields => { pc => 'GL50 2PR' } },
+ "submit location" );
+ $mech->follow_link_ok(
+ { text_regex => qr/skip this step/i, },
+ "follow 'skip this step' link"
+ );
+
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ title => "Inspector report",
+ detail => 'Inspector report details.',
+ photo1 => '',
+ name => 'Joe Bloggs',
+ may_show_name => '1',
+ phone => '07903 123 456',
+ category => 'Trees',
+ }
+ },
+ "submit good details"
+ );
+
+ like $mech->uri->path, qr/\/report\/[0-9]+/, 'Redirects directly to report';
+ }
+};
+
done_testing();
END {