diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-02-13 17:23:43 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-02-16 20:23:12 +0000 |
commit | 684405c7808cc71567f52cbba6d595326438b876 (patch) | |
tree | ab0c9860fca6057b7dadd80855b2916512533835 /t/app/controller | |
parent | b82662a6173e7f20ed19f80b4fae3c405bcff4ea (diff) |
Store questionnaire data as soon as opened.
This means the questionnaire is considered 'answered' as soon as
a (HTML) link is clicked, which I think is okay. Then filling in
the questionnaire form will update the same questionnaire.
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/questionnaire.t | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index 0dcfdaba6..75542d759 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -108,6 +108,23 @@ foreach my $test ( }; } +subtest "If been_fixed is provided in the URL" => sub { + $mech->get_ok("/Q/" . $token->token . "?been_fixed=Yes"); + $mech->content_contains('id="been_fixed_yes" value="Yes" checked'); + $report->discard_changes; + is $report->state, 'fixed - user'; + $questionnaire->discard_changes; + is $questionnaire->old_state, 'confirmed'; + is $questionnaire->new_state, 'fixed - user'; + $mech->submit_form_ok({ with_fields => { been_fixed => 'Unknown', reported => 'Yes', another => 'No' } }); + $report->discard_changes; + is $report->state, 'confirmed'; + $questionnaire->discard_changes; + is $questionnaire->old_state, 'confirmed'; + is $questionnaire->new_state, 'unknown'; + $questionnaire->update({ whenanswered => undef, ever_reported => undef, old_state => undef, new_state => undef }); +}; + $mech->get_ok("/Q/" . $token->token); $mech->title_like( qr/Questionnaire/ ); $mech->submit_form_ok( ); |