diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-04-20 16:04:57 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-07-13 09:42:50 +0100 |
commit | 02d06df3644d53aaa2611882491230fc28d843bd (patch) | |
tree | b2d884368b242dae61cfcab98c3b920ab24a1011 /t/app/controller/contact.t | |
parent | bd6ecb98fd3ad6f1602b0ea5593dea0bd96f8193 (diff) |
Have a whole fake mapit (for #182) that works if MAPIT_URL is set accordingly.
Setting MAPIT_URL to .../fakemapit/ will then return one area, ID 161 and
type ZZZ, whatever co-ordinate it is given. This means the default area
type is now ZZZ, the UK specific types are moved into the UK cobrands, and
the tests updated accordingly to still function (they assume UK-ness a lot,
so probably need an ALLOWED_COBRANDS entry of "fixmystreet: 'localhost'" and
for your host's domain to show fixmystreet too).
Diffstat (limited to 't/app/controller/contact.t')
-rw-r--r-- | t/app/controller/contact.t | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t index 970241d12..11e0d30cf 100644 --- a/t/app/controller/contact.t +++ b/t/app/controller/contact.t @@ -131,8 +131,7 @@ for my $test ( message => '', }, page_errors => - [ 'There were problems with your report. Please see below.', ], - field_errors => [ + [ 'There were problems with your report. Please see below.', 'Please enter your name', 'Please enter your email', 'Please enter a subject', @@ -147,8 +146,7 @@ for my $test ( message => '', }, page_errors => - [ 'There were problems with your report. Please see below.', ], - field_errors => [ + [ 'There were problems with your report. Please see below.', 'Please enter your name', 'Please enter a valid email address', 'Please enter a subject', @@ -162,9 +160,10 @@ for my $test ( subject => '', message => '', }, - page_errors => - [ 'There were problems with your report. Please see below.', ], - field_errors => [ 'Please enter a subject', 'Please write a message', ] + page_errors => [ + 'There were problems with your report. Please see below.', + 'Please enter a subject', 'Please write a message', + ] }, { fields => { @@ -173,9 +172,10 @@ for my $test ( subject => 'A subject', message => '', }, - page_errors => - [ 'There were problems with your report. Please see below.', ], - field_errors => [ 'Please write a message', ] + page_errors => [ + 'There were problems with your report. Please see below.', + 'Please write a message', + ] }, { fields => { @@ -184,9 +184,11 @@ for my $test ( subject => ' ', message => '', }, - page_errors => - [ 'There were problems with your report. Please see below.', ], - field_errors => [ 'Please enter a subject', 'Please write a message', ] + page_errors => [ + 'There were problems with your report. Please see below.', + 'Please enter a subject', + 'Please write a message', + ] }, { fields => { @@ -195,9 +197,10 @@ for my $test ( subject => 'A subject', message => ' ', }, - page_errors => - [ 'There were problems with your report. Please see below.', ], - field_errors => [ 'Please write a message', ] + page_errors => [ + 'There were problems with your report. Please see below.', + 'Please write a message', + ] }, { url => '/contact?id=' . $problem_main->id, @@ -209,7 +212,6 @@ for my $test ( id => 'invalid', }, page_errors => [ 'Illegal ID' ], - field_errors => [] }, ) { @@ -217,7 +219,6 @@ for my $test ( $mech->get_ok( $test->{url} ? $test->{url} : '/contact' ); $mech->submit_form_ok( { with_fields => $test->{fields} } ); is_deeply $mech->page_errors, $test->{page_errors}, 'page errors'; - is_deeply $mech->form_errors, $test->{field_errors}, 'field_errors'; # we santise this when we submit so need to remove it delete $test->{fields}->{id} |