diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-23 09:54:08 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-01-25 16:49:08 +0000 |
commit | 8fcff2a03a742730922bc620de253dcf6660909f (patch) | |
tree | a46e9b0124a93a16581ca3c4b5307f49bdd20988 /t | |
parent | 84a132729508b33fd2120a8ad8644c07a5658ea1 (diff) |
Spot moderation conflicts.
If someone tries to moderate after someone else has, re-show the
form and an error.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/moderate.t | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/t/app/controller/moderate.t b/t/app/controller/moderate.t index 438a81b25..7ef24bbe8 100644 --- a/t/app/controller/moderate.t +++ b/t/app/controller/moderate.t @@ -139,6 +139,20 @@ subtest 'Problem moderation' => sub { is $history[1]->title, 'Good good', 'Correct second title'; }; + subtest 'Post modified title after edited elsewhere' => sub { + $mech->submit_form_ok({ with_fields => { + %problem_prepopulated, + problem_title => 'Good good', + form_started => 1, # January 1970! + }}); + $mech->base_like( qr{\Q/moderate$REPORT_URL\E} ); + $mech->content_contains('Good bad good'); # Displayed title + $mech->content_contains('Good good'); # Form edit + + $report->discard_changes; + is $report->title, 'Good bad good', 'title unchanged'; + }; + subtest 'Make anonymous' => sub { $mech->content_lacks('Reported anonymously'); |