diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-10-03 17:19:42 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-10-03 17:42:24 +0100 |
commit | 5b3824c84f0ade0d8ac9258eb30379f8d7e11023 (patch) | |
tree | 56a53d3b4dde623447f0d89d1b3c5ea248660522 /t/app/controller | |
parent | 39c1b648b30e67ceb8912a35b386eb4ee23857b8 (diff) |
Allow closed->fixed transition in questionnaire, and spot closed problems in response text (fix #269).
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/questionnaire.t | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index 3475307fb..3a6a3d6ad 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -190,6 +190,25 @@ foreach my $test ( # update => 'Dummy', Error for not setting this tested below }, }, + { + desc => 'Closed report, said fixed, reported before, no update, no further questionnaire', + problem_state => 'closed', + fields => { + been_fixed => 'Yes', + reported => 'Yes', + another => 'No', + }, + }, + { + desc => 'Closed report, said not fixed, reported before, no update, no further questionnaire', + problem_state => 'closed', + fields => { + been_fixed => 'No', + reported => 'Yes', + another => 'No', + }, + lastupdate_static => 1, + }, ) { subtest $test->{desc} => sub { $report->state ( $test->{problem_state} ); @@ -224,7 +243,8 @@ foreach my $test ( $result = 'fixed' if $test->{fields}{been_fixed} eq 'Yes' && $test->{problem_state} eq 'fixed'; - $result = 'confirmed' if $test->{fields}{been_fixed} eq 'No'; + $result = 'confirmed' if $test->{fields}{been_fixed} eq 'No' && $test->{problem_state} ne 'closed'; + $result = 'closed' if $test->{fields}{been_fixed} eq 'No' && $test->{problem_state} eq 'closed'; $result = 'unknown' if $test->{fields}{been_fixed} eq 'Unknown'; my $another = 0; @@ -234,10 +254,12 @@ foreach my $test ( $mech->content_like( qr/<title>[^<]*Questionnaire/m ); $mech->content_contains( 'glad to hear it’s been fixed' ) if $result =~ /fixed/; + $mech->content_lacks( 'glad to hear it’s been fixed' ) + if $result !~ /fixed/; $mech->content_contains( 'get some more information about the status of your problem' ) if $result eq 'unknown'; $mech->content_contains( "sorry to hear that" ) - if $result eq 'confirmed'; + if $result eq 'confirmed' || $result eq 'closed'; # Check the database has the right information $report->discard_changes; |