aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand/fixamingata.t
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2015-08-26 13:43:10 +0200
committerMarius Halden <marius.h@lden.org>2015-08-26 13:43:10 +0200
commitcc0acdd34052e79f3df368ac1f524de31df19a1b (patch)
tree505f561b5f16c5b78f07514e8c2b2bdc18fef51d /t/cobrand/fixamingata.t
parent1c5c685d0b0904e7ddc6e764e58e8fae08632d1d (diff)
parent6b84622fb7d58531baa7943abdcc7620999c34ee (diff)
Merge tag 'v1.6.1' into fiksgatami-dev
Diffstat (limited to 't/cobrand/fixamingata.t')
-rw-r--r--t/cobrand/fixamingata.t32
1 files changed, 25 insertions, 7 deletions
diff --git a/t/cobrand/fixamingata.t b/t/cobrand/fixamingata.t
index 105847576..3c818474d 100644
--- a/t/cobrand/fixamingata.t
+++ b/t/cobrand/fixamingata.t
@@ -1,12 +1,16 @@
use strict;
use warnings;
use Test::More;
+use LWP::Protocol::PSGI;
BEGIN {
use FixMyStreet;
FixMyStreet->test_mode(1);
}
+use t::MapIt;
+use mySociety::Locale;
+
use FixMyStreet::TestMech;
my $mech = FixMyStreet::TestMech->new;
@@ -21,16 +25,11 @@ FixMyStreet::override_config {
$mech->content_like( qr/FixaMinGata/ );
my $body = $mech->create_body_ok( 1, 'Body' );
-FixMyStreet::App->model('DB::Contact')->find_or_create({
+$mech->create_contact_ok(
body => $body,
category => "Other",
email => "other\@example.org",
- confirmed => 1,
- deleted => 0,
- editor => "Editor",
- whenedited => \'now()',
- note => 'Note',
-});
+);
my @reports = $mech->create_problems_for_body( 1, $body->id, 'Test', {
cobrand => 'fixamingata',
@@ -96,6 +95,25 @@ like $email->header('Content-Type'), qr/iso-8859-1/, 'encoding looks okay';
like $email->body, qr/V=E4nligen,/, 'signature looks correct';
$mech->clear_emails_ok;
+subtest "Test ajax decimal points" => sub {
+ # The following line is so we are definitely not in Swedish before
+ # requesting the page, so that the code performs a full switch to Swedish
+ mySociety::Locale::push('en-gb');
+
+ # A note to the future - the run_if_script line must be within a subtest
+ # otherwise it fails to work
+ LWP::Protocol::PSGI->register(t::MapIt->run_if_script, host => 'mapit.sweden');
+
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixamingata' ],
+ MAPIT_URL => 'http://mapit.sweden/'
+ }, sub {
+ $mech->get_ok('/ajax/lookup_location?term=12345');
+ # We want an actual decimal point in a JSON response...
+ $mech->content_contains('51.5');
+ };
+};
+
END {
$mech->delete_problems_for_body(1);
ok $mech->host("www.fixmystreet.com"), "change host back";