aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/index.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/app/controller/index.t b/t/app/controller/index.t
index 346ccb2e1..6752d4d7e 100644
--- a/t/app/controller/index.t
+++ b/t/app/controller/index.t
@@ -80,7 +80,24 @@ ok $mech->get('/report/' . $edinburgh_problems[2]->id);
is $mech->res->code, 403, 'page forbidden';
is $problem_rs->count, $num+5;
+my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council', id => 2237);
+subtest "prefilters /around if user has categories" => sub {
+ my $user = $mech->log_in_ok('test@example.com');
+ my $categories = [
+ $mech->create_contact_ok( body_id => $oxon->id, category => 'Cows', email => 'cows@example.net' )->id,
+ $mech->create_contact_ok( body_id => $oxon->id, category => 'Potholes', email => 'potholes@example.net' )->id,
+ ];
+ $user->from_body($oxon);
+ $user->set_extra_metadata('categories', $categories);
+ $user->update;
+
+ $mech->get_ok('/');
+ # NB can't use visible_form_values because categories field is hidden
+ $mech->content_contains("Cows,Potholes");
+};
+
END {
$mech->delete_problems_for_body( 2651 );
+ $mech->delete_body($oxon);
done_testing();
}