aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2018-07-11 16:23:42 +0100
committerDave Arter <davea@mysociety.org>2018-07-11 16:23:42 +0100
commit7c3845be8d26778e93a790ad212b230fbd847d43 (patch)
tree7736022c771754185dd5f8db8af7be107c50a5f8 /t
parent49fdf020d77bbdaf052cc403fb76f5696bc368ea (diff)
Allow questionnaire pages to be revisited within 2 minutes
Users who double click links were seeing an error when visiting the questionnaire page. This change gives a grace period of two minutes for revisiting the questionnaire page. Fixes #2123.
Diffstat (limited to 't')
-rw-r--r--t/app/controller/questionnaire.t11
1 files changed, 9 insertions, 2 deletions
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index 75542d759..bfc61ae17 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -85,10 +85,16 @@ foreach my $test (
},
{
desc => 'User goes to questionnaire URL for an already answered questionnaire',
- answered => \'current_timestamp',
+ answered => \"current_timestamp - '10 minutes'::interval",
content => 'already answered this questionnaire',
code => 400,
},
+ {
+ desc => 'User goes to questionnaire URL for a very recently answered questionnaire',
+ answered => \"current_timestamp - '10 seconds'::interval",
+ content_lacks => 'already answered this questionnaire',
+ code => 200,
+ },
) {
subtest $test->{desc} => sub {
$report->state( $test->{state} || 'confirmed' );
@@ -99,7 +105,8 @@ foreach my $test (
$token .= $test->{token_extra} if $test->{token_extra};
$mech->get("/Q/$token");
is $mech->res->code, $test->{code}, "Right status received";
- $mech->content_contains( $test->{content} );
+ $mech->content_contains( $test->{content} ) if $test->{content};
+ $mech->content_lacks( $test->{content_lacks} ) if $test->{content_lacks};
# Reset, no matter what test did
$report->state( 'confirmed' );
$report->update;