From 51901828ee898f05f515abfabac635453666ee7b Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 16 May 2012 18:09:46 +0100 Subject: make banner tests a bit more tolerant --- t/app/controller/report_updates.t | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 't/app/controller') diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 9c2b0861b..0337a881b 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -872,7 +872,11 @@ for my $test ( is_deeply $values, $test->{initial_values}, 'initial form values'; - is $mech->extract_problem_banner->{text}, $test->{initial_banner}, 'initial banner'; + if ( !defined( $test->{initial_banner} ) ) { + is $mech->extract_problem_banner->{text}, undef, 'initial banner'; + } else { + like $mech->extract_problem_banner->{text}, qr/@{[ $test->{initial_banner} ]}/i, 'initial banner'; + } $mech->submit_form_ok( { @@ -883,7 +887,11 @@ for my $test ( is $mech->uri->path, "/report/" . $report_id, "redirected to report page"; - is $mech->extract_problem_banner->{text}, $test->{endstate_banner}, 'submitted banner'; + if ( !defined( $test->{endstate_banner} ) ) { + is $mech->extract_problem_banner->{text}, undef, 'endstate banner'; + } else { + like $mech->extract_problem_banner->{text}, qr/@{[ $test->{endstate_banner} ]}/i, 'endstate banner'; + } $mech->email_count_is(0); @@ -1029,8 +1037,12 @@ foreach my $test ( is_deeply $values, $test->{initial_values}, 'initial form values'; - is $mech->extract_problem_banner->{text}, $test->{initial_banner}, - 'initial banner'; + if ( !defined( $test->{initial_banner} ) ) { + is $mech->extract_problem_banner->{text}, undef, 'initial banner'; + } else { + like $mech->extract_problem_banner->{text}, qr/@{[ $test->{initial_banner} ]}/i, + 'initial banner'; + } $mech->submit_form_ok( { with_fields => $test->{fields}, }, 'submit update' ); -- cgit v1.2.3