From 630ed304d67f83ecd8848bf665b03fd7c27fff46 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 21 Jun 2011 16:11:42 +0100 Subject: remove more hardcoded references to fixed --- t/app/controller/questionnaire.t | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 't/app/controller/questionnaire.t') diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index e56734bfc..af99a058e 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -204,7 +204,12 @@ foreach my $test ( } my $result; - $result = 'fixed' if $test->{fields}{been_fixed} eq 'Yes'; + $result = 'fixed - user' + if $test->{fields}{been_fixed} eq 'Yes' + && $test->{problem_state} ne 'fixed'; + $result = 'fixed' + if $test->{fields}{been_fixed} eq 'Yes' + && $test->{problem_state} eq 'fixed'; $result = 'confirmed' if $test->{fields}{been_fixed} eq 'No'; $result = 'unknown' if $test->{fields}{been_fixed} eq 'Unknown'; @@ -214,7 +219,7 @@ foreach my $test ( # Check the right HTML page has been returned $mech->content_like( qr/[^<]*Questionnaire/m ); $mech->content_contains( 'glad to hear it’s been fixed' ) - if $result eq '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" ) -- cgit v1.2.3 From 2c66aa1aa7c6c07c2146ebbccbf0b25f2ea97a3e Mon Sep 17 00:00:00 2001 From: Struan Donald <struan@exo.org.uk> Date: Tue, 28 Jun 2011 10:30:58 +0100 Subject: display update marked as fixed text on questionnaire for all fixed states --- t/app/controller/questionnaire.t | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 't/app/controller/questionnaire.t') diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index af99a058e..ecb243709 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -255,6 +255,55 @@ foreach my $test ( }; } + +for my $test ( + { + state => 'confirmed', + fixed => 0 + }, + { + state => 'planned', + fixed => 0 + }, + { + state => 'in progress', + fixed => 0 + }, + { + state => 'investigating', + fixed => 0 + }, + { + state => 'closed', + fixed => 0 + }, + { + state => 'fixed', + fixed => 1 + }, + { + state => 'fixed - council', + fixed => 1 + }, + { + state => 'fixed - user', + fixed => 1 + }, +) { + subtest "correct fixed text for state $test->{state}" => sub { + $report->state ( $test->{state} ); + $report->update; + + $mech->get_ok("/Q/" . $token->token); + $mech->title_like( qr/Questionnaire/ ); + if ( $test->{fixed} ) { + $mech->content_contains('An update marked this problem as fixed'); + } else { + $mech->content_lacks('An update marked this problem as fixed'); + } + }; +} + # EHA extra checking ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes'; -- cgit v1.2.3 From 96da0c04218644450f141f20c1dee4247a0ed8fe Mon Sep 17 00:00:00 2001 From: Struan Donald <struan@exo.org.uk> Date: Tue, 28 Jun 2011 14:51:17 +0100 Subject: correctly set mark_open/fixed in questionnaire generates updates --- t/app/controller/questionnaire.t | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't/app/controller/questionnaire.t') diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index ecb243709..af3b373ac 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -240,6 +240,16 @@ foreach my $test ( { problem_id => $report->id } ); is $c->text, $test->{fields}{update} || $test->{comment}; + if ( $result =~ /fixed/ ) { + ok $c->mark_fixed, 'comment marked as fixed'; + ok !$c->mark_open, 'comment not marked as open'; + } elsif ( $result eq 'confirmed' ) { + ok $c->mark_open, 'comment marked as open'; + ok !$c->mark_fixed, 'comment not marked as fixed'; + } elsif ( $result eq 'unknown' ) { + ok !$c->mark_open, 'comment not marked as open'; + ok !$c->mark_fixed, 'comment not marked as fixed'; + } } # Reset questionnaire for next test -- cgit v1.2.3