aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-07-27 13:54:46 +0100
committerStruan Donald <struan@exo.org.uk>2011-07-27 13:54:46 +0100
commite1801441beb37f37857c925a3c8c889653da4fe9 (patch)
treed12e6335e11da59396f109bc93abf128bf13089c /t/app/controller
parent54066cd1387643dd6c6cb3040c520bee66881fd7 (diff)
allow council user to update state on problem sent to multiple councils
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_display.t17
-rw-r--r--t/app/controller/report_updates.t21
2 files changed, 37 insertions, 1 deletions
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 23b76fbc4..a70d5b9e9 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -313,16 +313,25 @@ for my $test (
desc => 'no state dropdown if user not from authority',
from_council => 0,
no_state => 1,
+ report_council => '2504',
},
{
desc => 'state dropdown if user from authority',
from_council => 2504,
no_state => 0,
+ report_council => '2504',
},
{
desc => 'no state dropdown if user not from same council as problem',
from_council => 2505,
no_state => 1,
+ report_council => '2504',
+ },
+ {
+ desc => 'state dropdown if user from authority and problem sent to multiple councils',
+ from_council => 2504,
+ no_state => 0,
+ report_council => '2504,2506',
},
) {
subtest $test->{desc} => sub {
@@ -330,6 +339,10 @@ for my $test (
$user->from_council( $test->{from_council} );
$user->update;
+ $report->discard_changes;
+ $report->council( $test->{report_council} );
+ $report->update;
+
$mech->get_ok("/report/$report_id");
my $fields = $mech->visible_form_values( 'updateForm' );
if ( $test->{no_state} ) {
@@ -340,6 +353,10 @@ for my $test (
};
}
+$report->discard_changes;
+$report->council( 2504 );
+$report->update;
+
# tidy up
$mech->delete_user('test@example.com');
done_testing();
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 0a9c5db1f..d7b234a6e 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -539,14 +539,31 @@ for my $test (
may_show_name => 1,
add_alert => 0,
photo => '',
- update => 'Set state to investigating',
+ update => 'Set state to confirmed',
state => 'confirmed',
},
state => 'confirmed',
},
+ {
+ desc => 'from authority user marks report sent to two councils as fixed',
+ fields => {
+ name => $user->name,
+ may_show_name => 1,
+ add_alert => 0,
+ photo => '',
+ update => 'Set state to fixed',
+ state => 'fixed',
+ },
+ state => 'fixed - council',
+ report_councils => '2504,2505',
+ },
) {
subtest $test->{desc} => sub {
$report->comments->delete;
+ if ( $test->{ report_councils } ) {
+ $report->council( $test->{ report_councils } );
+ $report->update;
+ }
$mech->log_in_ok( $user->email );
$user->from_council( 2504 );
@@ -561,6 +578,7 @@ for my $test (
'submit update'
);
+ $report->discard_changes;
my $update = $report->comments->first;
ok $update, 'found update';
is $update->text, $test->{fields}->{update}, 'update text';
@@ -580,6 +598,7 @@ $user->from_council(0);
$user->update;
$report->state('confirmed');
+$report->council('2504');
$report->update;
for my $test (