diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-17 15:54:56 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-23 10:10:30 +0000 |
commit | 2f02c377f44bd2b7cc16f3fdbefb85ed5fa25fdb (patch) | |
tree | f42e906998ed0d1789b023f98cc3ec138501ea9e /t/cobrand | |
parent | f44ad2f067346cb3b03d3711fd658a5516e9fd0c (diff) |
[Buckinghamshire] Question for on-road flytipping.
This adds a question to check whether a flytipping report concerns
flytipping on a road or not. Client-side, it is asked when a road is
selected and destination adjusted according to the answer; server side
it uses the answer to direct any both-tier submissions (from e.g.
non-JavaScript or phone app).
Diffstat (limited to 't/cobrand')
-rw-r--r-- | t/cobrand/bucks.t | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/t/cobrand/bucks.t b/t/cobrand/bucks.t index a894bd377..d9273fbf8 100644 --- a/t/cobrand/bucks.t +++ b/t/cobrand/bucks.t @@ -80,10 +80,31 @@ subtest 'flytipping off road sent to extra email' => sub { is $report->external_id, undef, 'Report has right external ID'; }; -}; - $cobrand = FixMyStreet::Cobrand::Buckinghamshire->new(); +subtest 'Flytipping extra question used if necessary' => sub { + my $errors = { 'road-placement' => 'This field is required' }; + + $report->update({ bodies_str => $body->id }); + $cobrand->flytipping_body_fix($report, 'road', $errors); + is $errors->{'road-placement'}, 'This field is required', 'Error stays if sent to county'; + + $report->update({ bodies_str => $district->id }); + $report->discard_changes; # As e.g. ->bodies has been remembered. + $cobrand->flytipping_body_fix($report, 'road', $errors); + is $errors->{'road-placement'}, undef, 'Error removed if sent to district'; + + $report->update({ bodies_str => $body->id . ',' . $district->id }); + $report->discard_changes; # As e.g. ->bodies has been remembered. + $cobrand->flytipping_body_fix($report, 'road', $errors); + is $report->bodies_str, $body->id, 'Sent to both becomes sent to county on-road'; + + $report->update({ bodies_str => $district->id . ',' . $body->id }); + $report->discard_changes; # As e.g. ->bodies has been remembered. + $cobrand->flytipping_body_fix($report, 'off-road', $errors); + is $report->bodies_str, $district->id, 'Sent to both becomes sent to district off-road'; +}; + for my $test ( { desc => 'filters basic emails', @@ -151,6 +172,6 @@ for my $test ( }; } - +}; done_testing(); |