diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-04-13 11:13:39 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-04-13 11:13:39 +0100 |
commit | 90c05378d5b870b94865189f7b72583ac5022c94 (patch) | |
tree | 98a2ef22f0420759bc8c58f67d732fa21a15bc14 /perllib/FixMyStreet/TestMech.pm | |
parent | 23c8cc3c0f7f728e069429dfb3db7eaddd0bcc62 (diff) |
Moved some of the location smarts from '/report/new' to '/around'
Diffstat (limited to 'perllib/FixMyStreet/TestMech.pm')
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 26738556d..6a4382c3d 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -204,6 +204,24 @@ sub form_errors { return $result->{errors} || []; } +=head2 page_errors + + my $arrayref = $mech->page_errors; + +Find all the form errors on the current page and return them in page order as an +arrayref of TEXTs. If none found return empty arrayref. + +=cut + +sub page_errors { + my $mech = shift; + my $result = scraper { + process 'p.error', 'errors[]', 'TEXT'; + } + ->scrape( $mech->response ); + return $result->{errors} || []; +} + =head2 import_errors my $arrayref = $mech->import_errors; |