aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-05-15 22:51:29 +0100
committerStruan Donald <struan@exo.org.uk>2012-05-15 22:51:29 +0100
commite14373d9c9ece3497a12e712a823577f923fa25a (patch)
tree988c0b4480bba790eea0dbd751c6c3919182c6b8 /t/app/controller
parent67be3761781b6c5a2690474f65bc752e6d65cef1 (diff)
tests for limiting by ward
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/dashboard.t32
1 files changed, 31 insertions, 1 deletions
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index f814a2dd3..a658eb68c 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -390,6 +390,35 @@ for my $test (
totals => [1,1,3,3],
}
},
+ {
+ desc => 'Limit display by ward',
+ p1 => {
+ state => 'confirmed',
+ conf_dt => DateTime->now()->subtract( weeks => 1 ),
+ category => 'Potholes',
+ # in real life it has commas around it and the search
+ # uses them
+ areas => ',20720,',
+ },
+ p2 => {
+ state => 'fixed - council',
+ conf_dt => DateTime->now()->subtract( weeks => 1 ),
+ mark_dt => DateTime->now()->subtract( weeks => 1 ),
+ category => 'Litter',
+ areas => ',20720,',
+ },
+ ward => 20720,
+ counts => {
+ user => [0,0,2,2],
+ council => [0,0,3,3],
+ totals => [2,2,8,8],
+ },
+ counts_after => {
+ user => [0,0,0,0],
+ council => [0,0,1,1],
+ totals => [0,0,2,2],
+ }
+ },
) {
subtest $test->{desc} => sub {
make_problem( $test->{p1} ) if $test->{p1};
@@ -406,6 +435,7 @@ for my $test (
$mech->submit_form_ok( {
with_fields => {
category => $test->{category},
+ ward => $test->{ward},
}
} );
@@ -433,7 +463,7 @@ sub make_problem {
postcode => 'EH99 1SP',
latitude => '51',
longitude => '1',
- areas => $test_ward,
+ areas => $args->{areas} || $test_ward,
used_map => 0,
user_id => $p_user->id,
category => $args->{category} || 'Other',