diff options
author | Struan Donald <struan@exo.org.uk> | 2017-09-19 15:44:32 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2017-09-27 14:01:02 +0100 |
commit | 93895ef28331f60201565b83e674a1ec1365ed55 (patch) | |
tree | 5c9eadffe69ddcddc43a47e8397a7f9d4d2f192f /t/app/controller | |
parent | af3c5e24b651b90fe061fd41453c0b4031a263c1 (diff) |
limit detailed_information to 172 characters
RDI files have a 180 character limit for the description so limit the
description to 172 to allow for the ID which is also included in this
field.
Fixes mysociety/fixmystreetforcouncils#228
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/report_inspect.t | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 5bbbdff79..be8f12cc5 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -261,6 +261,37 @@ FixMyStreet::override_config { }); }; } + + subtest "detailed_information has max length" => sub { + $user->user_body_permissions->delete; + $user->user_body_permissions->create({ body => $oxon, permission_type => 'report_inspect' }); + $mech->get_ok("/report/$report_id"); + $mech->submit_form_ok({ + button => 'save', + with_fields => { + include_update => 0, + detailed_information => 'XXX172XXX' . 'x' x 163, + } + }); + + $report->discard_changes; + like $report->get_extra_metadata('detailed_information'), qr/XXX172XXX/, 'detailed information saved'; + $mech->content_lacks('limited to 172 characters', "172 charcters of detailed information ok"); + $mech->content_contains('XXX172XXX', "Detailed information field contains submitted text"); + + $mech->submit_form_ok({ + button => 'save', + with_fields => { + include_update => 0, + detailed_information => 'XXX173XXX' . 'x' x 164, + } + }); + $mech->content_contains('limited to 172 characters', "173 charcters of detailed information not ok"); + $mech->content_contains('XXX173XXX', "Detailed information field contains submitted text"); + + $report->discard_changes; + like $report->get_extra_metadata('detailed_information'), qr/XXX172XXX/, 'detailed information not saved'; + }; }; FixMyStreet::override_config { |