aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_import.t4
-rw-r--r--t/app/controller/report_new.t14
-rw-r--r--t/app/controller/report_updates.t10
-rw-r--r--t/app/model/problem.t4
-rw-r--r--t/map/tilma/original.t14
-rw-r--r--t/utils.t25
6 files changed, 47 insertions, 24 deletions
diff --git a/t/app/controller/report_import.t b/t/app/controller/report_import.t
index d6bff240c..934bf0346 100644
--- a/t/app/controller/report_import.t
+++ b/t/app/controller/report_import.t
@@ -128,7 +128,7 @@ subtest "Submit a correct entry" => sub {
"check imported fields are shown";
# Check photo present, and still there after map submission (testing bug #18)
- $mech->content_contains( '<img align="right" src="/photo?id' );
+ $mech->content_contains( '<img align="right" src="/photo/' );
$mech->content_contains('latitude" value="51.50101"', 'Check latitude');
$mech->content_contains('longitude" value="-0.141587"', 'Check longitude');
$mech->submit_form_ok(
@@ -139,7 +139,7 @@ subtest "Submit a correct entry" => sub {
},
"New map location"
);
- $mech->content_contains( '<img align="right" src="/photo?id' );
+ $mech->content_contains( '<img align="right" src="/photo/' );
$mech->content_contains('latitude" value="51.50519"', 'Check latitude');
$mech->content_contains('longitude" value="-0.142608"', 'Check longitude');
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 076813868..625c7531f 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -191,7 +191,7 @@ foreach my $test (
changes => {},
errors => [
'Please enter your email',
-'Please enter your full name, councils need this information - if you do not wish your name to be shown on the site, untick the box',
+'Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below',
],
},
{
@@ -213,7 +213,7 @@ foreach my $test (
changes => {},
errors => [
'Please enter your email',
-'Please enter your full name, councils need this information - if you do not wish your name to be shown on the site, untick the box',
+'Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below',
],
},
{
@@ -360,7 +360,7 @@ foreach my $test (
"submit location" );
# click through to the report page
- $mech->follow_link_ok( { text => 'skip this step', },
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, },
"follow 'skip this step' link" );
$mech->submit_form_ok(
@@ -473,7 +473,7 @@ subtest "test password errors for a user who is signing in as they report" => su
"submit location" );
# click through to the report page
- $mech->follow_link_ok( { text => 'skip this step', },
+ $mech->follow_link_ok( { text => 'Skip this step', },
"follow 'skip this step' link" );
$mech->submit_form_ok(
@@ -493,7 +493,7 @@ subtest "test password errors for a user who is signing in as they report" => su
# check that we got the errors expected
is_deeply $mech->form_errors, [
- 'There was a problem with your email/password combination. Passwords and user accounts are a brand new service, so you probably do not have one yet – please fill in the right hand side of this form to get one.'
+ "There was a problem with your email/password combination. If you cannot remember your password, or do not have one, please fill in the \x{2018}sign in by email\x{2019} section of the form.",
], "check there were errors";
};
@@ -520,7 +520,7 @@ subtest "test report creation for a user who is signing in as they report" => su
"submit location" );
# click through to the report page
- $mech->follow_link_ok( { text => 'skip this step', },
+ $mech->follow_link_ok( { text => 'Skip this step', },
"follow 'skip this step' link" );
$mech->submit_form_ok(
@@ -614,7 +614,7 @@ foreach my $test (
"submit location" );
# click through to the report page
- $mech->follow_link_ok( { text => 'skip this step', },
+ $mech->follow_link_ok( { text => 'Skip this step', },
"follow 'skip this step' link" );
# check that the fields are correctly prefilled
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 39cb5d6d8..9c2b0861b 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -604,7 +604,7 @@ for my $test (
password_sign_in => 'secret',
},
field_errors => [
- "There was a problem with your email/password combination. Passwords and user accounts are a brand new service, so you probably do not have one yet \x{2013} please fill in the right hand side of this form to get one.",
+ "There was a problem with your email/password combination. If you cannot remember your password, or do not have one, please fill in the \x{2018}sign in by email\x{2019} section of the form.",
'Please enter your name', # FIXME Not really necessary error
],
},
@@ -826,7 +826,7 @@ for my $test (
update => 'Update from a registered user'
},
initial_banner => undef,
- endstate_banner => ' This problem has been fixed. ',
+ endstate_banner => 'Fixed',
alert => 1,
anonymous => 0,
},
@@ -848,8 +848,8 @@ for my $test (
changed => {
update => 'Another update from a registered user'
},
- initial_banner => ' This problem has been fixed. ',
- endstate_banner => ' This problem has been fixed. ',
+ initial_banner => 'Fixed',
+ endstate_banner => 'Fixed',
alert => 0,
anonymous => 0,
},
@@ -953,7 +953,7 @@ foreach my $test (
fixed => 1,
},
changed => { update => 'Update from owner' },
- initial_banner => ' This problem is in progress. ',
+ initial_banner => 'In progress',
initial_state => 'in progress',
alert => 1, # we signed up for alerts before, do not unsign us
anonymous => 0,
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 57066edb3..a7415851b 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -57,7 +57,7 @@ for my $test (
title => 'Please enter a subject',
detail => 'Please enter some details',
council => 'No council selected',
- name => 'Please enter your full name, councils need this information - if you do not wish your name to be shown on the site, untick the box',
+ name => 'Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below',
}
},
{
@@ -69,7 +69,7 @@ for my $test (
title => 'Please enter a subject',
detail => 'Please enter some details',
council => 'No council selected',
- name => 'Please enter your full name, councils need this information - if you do not wish your name to be shown on the site, untick the box',
+ name => 'Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below',
}
},
{
diff --git a/t/map/tilma/original.t b/t/map/tilma/original.t
index 3add7719e..04c4d578c 100644
--- a/t/map/tilma/original.t
+++ b/t/map/tilma/original.t
@@ -56,31 +56,31 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
for my $test (
{
state => 'fixed',
- colour => 'green',
+ colour => 'yellow',
},
{
state => 'fixed - user',
- colour => 'green',
+ colour => 'yellow',
},
{
state => 'fixed - council',
- colour => 'green',
+ colour => 'yellow',
},
{
state => 'confirmed',
- colour => 'red',
+ colour => 'yellow',
},
{
state => 'investigating',
- colour => 'red',
+ colour => 'yellow',
},
{
state => 'planned',
- colour => 'red',
+ colour => 'yellow',
},
{
state => 'in progress',
- colour => 'red',
+ colour => 'yellow',
},
) {
subtest "pin colour for state $test->{state}" => sub {
diff --git a/t/utils.t b/t/utils.t
index 385c482ed..8ff9266fd 100644
--- a/t/utils.t
+++ b/t/utils.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
use FindBin;
use lib "$FindBin::Bin/../perllib";
@@ -39,3 +39,26 @@ foreach my $test (@convert_en_to_latlon_tests) {
[ $lat, $lon ], #
"convert ($e,$n) to ($lat,$lon)";
}
+
+my @cleanup_tests = (
+ [ 'dog shit', 'Dog poo', 'dog poo' ],
+ [ 'dog shit', 'Dog poo', 'with spaces' ],
+ [ 'dog shite', 'Dog poo', 'with extra e' ],
+ [ 'there is dog shit here', 'There is dog poo here', 'with surrounding text' ],
+ [ 'portacabin', '[portable cabin]', 'cabin' ],
+ [ 'portaloo', '[portable loo]', 'loo' ],
+ [ 'porta loo', '[portable loo]', 'with spaces' ],
+ [ ' this is a report ', 'This is a report', 'leading and trailing spaces' ],
+ [ 'This is a report ', 'This is a report', 'spaces in the middle' ],
+ [ 'I AM SHOUTING AT YOU', 'I am shouting at you', 'all shouting' ],
+ [ 'I am EMPHASISING something', 'I am EMPHASISING something', 'some shouting' ],
+ [ "This has new\n\n\nlines in it", 'This has new Lines in it', 'no new lines' ],
+);
+
+foreach my $test ( @cleanup_tests ) {
+ is Utils::cleanup_text( $test->[0]), $test->[1], $test->[2];
+}
+
+is Utils::cleanup_text( "This has new\n\n\nlines in it", { allow_multiline => 1 } ), "This has new\n\nLines in it", 'new lines allowed';
+
+done_testing();