aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/report_inspect.t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-08-15 16:34:57 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-08-17 18:41:17 +0100
commit8b376fe18dc1994354ffd53314d6fbd20c562532 (patch)
treeafabc5900ebaee250260a820a84e6a6f4b008a34 /t/app/controller/report_inspect.t
parentc492c421f6796684ea430f4fff8297ca5b14fbd6 (diff)
show all report updates, even if no public text
Create a comment entry for all updates to reports regardless of whether there is any text part. Also adds an entry to extra if a defect was raised and includes that in the update status line. Fixes mysociety/fixmystreetforcouncils#201
Diffstat (limited to 't/app/controller/report_inspect.t')
-rw-r--r--t/app/controller/report_inspect.t16
1 files changed, 15 insertions, 1 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index e668fddbf..33486aa28 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -79,10 +79,21 @@ FixMyStreet::override_config {
public_update => "This is a public update.", include_update => "1",
state => 'action scheduled', raise_defect => 1,
} });
+ $mech->get_ok("/report/$report_id");
+ $mech->submit_form_ok({ with_fields => {
+ update => "This is a second public update, of normal update form, no actual change.",
+ } });
$report->discard_changes;
- is $report->comments->first->text, "This is a public update.", 'Update was created';
+ my $comment = ($report->comments( undef, { order_by => { -desc => 'id' } } )->all)[1]->text;
+ is $comment, "This is a public update.", 'Update was created';
is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected';
is $report->user->get_extra_metadata('reputation'), $reputation, "User reputation wasn't changed";
+ $mech->get_ok("/report/$report_id");
+ my $meta = $mech->extract_update_metas;
+ like $meta->[0], qr/Updated by .*action scheduled/, 'First update mentions action scheduled';
+ like $meta->[1], qr/Posted by .*defect raised/, 'Update mentions defect raised';
+ unlike $meta->[2], qr/Posted by .*action scheduled/, 'Update does not mention action scheduled';
+
$user->unset_extra_metadata('categories');
$user->update;
};
@@ -245,6 +256,9 @@ FixMyStreet::override_config {
} });
$report->discard_changes;
is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected';
+ $mech->get_ok("/report/$report_id");
+ my $meta = $mech->extract_update_metas;
+ like $meta->[-1], qr/Updated by .*defect raised/, 'Update mentions defect raised';
};
subtest "Oxfordshire-specific traffic management options are shown" => sub {