From a253bba519da66f2b0d3de09de895b5364de277f Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 26 Mar 2018 17:09:26 +0100 Subject: limit problem body to single body if required Add a single_body_only form value to reports that contains the name of the only body to send the problem to. If the name doesn't match any of the valid bodies for the report then send to all. --- t/app/controller/report_new.t | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 't/app/controller') diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index f937acd19..0e7547a85 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -944,9 +944,29 @@ foreach my $test ( # XXX add test for category with multiple bodies foreach my $test ( - { category => 'Street lighting', councils => [ 2226, 2326 ] }, + { + desc => "test report creation for multiple bodies", + category => 'Street lighting', + councils => [ 2226, 2326 ], + extra_fields => {}, + email_count => 2, + }, + { + desc => "test single_body_only means only one report body", + category => 'Street lighting', + councils => [ 2326 ], + extra_fields => { single_body_only => 'Cheltenham Borough Council' }, + email_count => 1, + }, + { + desc => "test invalid single_body_only means multiple report bodies", + category => 'Street lighting', + councils => [ 2226, 2326 ], + extra_fields => { single_body_only => 'Invalid council' }, + email_count => 1, + }, ) { - subtest "test report creation for multiple bodies" => sub { + subtest $test->{desc} => sub { # check that the user does not exist my $test_email = 'test-2@example.com'; @@ -1003,6 +1023,7 @@ foreach my $test ( may_show_name => '1', phone => '07903 123 456', category => $test->{category}, + %{$test->{extra_fields}} } }, "submit good details" -- cgit v1.2.3