aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/report_inspect.t76
1 files changed, 48 insertions, 28 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index be8f12cc5..fb18526ac 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -261,38 +261,58 @@ 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,
- }
- });
+foreach my $test (
+ { cobrand => 'fixmystreet', limited => 0, desc => 'detailed_information has no max length' },
+ { cobrand => 'oxfordshire', limited => 1, desc => 'detailed_information has max length' },
+) {
- $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");
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => $test->{cobrand},
+ }, sub {
+ subtest $test->{desc} => 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 not saved';
+ $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,
+ }
+ });
+ if ($test->{limited}) {
+ $mech->content_contains('172 characters maximum');
+ $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';
+ } else {
+ $mech->content_lacks(' characters maximum');
+ $mech->content_lacks('limited to 172 characters', "173 charcters of detailed information ok");
+ $mech->content_contains('XXX173XXX', "Detailed information field contains submitted text");
+
+ $report->discard_changes;
+ like $report->get_extra_metadata('detailed_information'), qr/XXX173XXX/, 'detailed information saved';
+ }
+ };
};
-};
+}
FixMyStreet::override_config {
ALLOWED_COBRANDS => 'oxfordshire',