aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/index.t
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-12 10:56:41 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-12 10:56:41 +0100
commitca9b31f2e35f7ba962569e8b705a89b6dd139de3 (patch)
treef866ca22bafca5e2aa9561554e5f7c6896a545cf /t/app/controller/index.t
parentf7d5358114fb2ca776e5ace250d2c53f0e1c7d70 (diff)
Start to move index.cgi into catalyst
Diffstat (limited to 't/app/controller/index.t')
-rw-r--r--t/app/controller/index.t39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/app/controller/index.t b/t/app/controller/index.t
new file mode 100644
index 000000000..1d0bff33c
--- /dev/null
+++ b/t/app/controller/index.t
@@ -0,0 +1,39 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+# check that the homepage loads
+$mech->get_ok('/');
+
+subtest "check that the form goes to /around" => sub {
+ $mech->get_ok('/');
+
+ # submit form
+ $mech->submit_form_ok( { with_fields => { pc => 'SW1A 1AA', } } );
+
+ # check that we are at /around
+ is $mech->res->uri->path, '/around', "Got to /around";
+ is $mech->res->uri->query_form, { pc => 'SW1A 1AA' }, "query passed along";
+};
+
+subtest "check that requests with pc, x,y or lat,lon go to /around" => sub {
+ foreach my $test (
+ { pc => 'SW1A 1AA', },
+ { x => 3281, y => 1113, },
+ { lat => 51.50100, lon => -0.14158, },
+ )
+ {
+ my $uri = URI->new('http://localhost/');
+ $uri->query_form($test);
+ $mech->get_ok($uri);
+
+ # check that we are at /around
+ is $mech->res->uri->path, '/around', "Got to /around";
+ is $mech->res->uri->query_form, $test, "query passed along";
+ }
+};
+
+done_testing();