aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller/around.t
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-12 15:13:59 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-12 15:13:59 +0100
commit7f6e0a5fef9d072135cb08b710e9dc6d06d6cac7 (patch)
treee825f20f0a8f5ba198458af6adc4fffa4944143b /t/app/controller/around.t
parenta38d76783ee9a44b9e237a87d086549677d3282e (diff)
Create Around controller and implement the easy bits
Diffstat (limited to 't/app/controller/around.t')
-rw-r--r--t/app/controller/around.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t
new file mode 100644
index 000000000..021cf8f7d
--- /dev/null
+++ b/t/app/controller/around.t
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+subtest "check that if no query we get sent back to the homepage" => sub {
+ $mech->get_ok('/around');
+ is $mech->uri->path, '/', "sent back to '/'";
+};
+
+# x,y requests were generated by the old map code. We keep the behavior for
+# historic links
+subtest "redirect x,y requests to lat/lon (301 - permanent)" => sub {
+
+ $mech->get_ok('/around?x=3281&y=1113');
+
+ # did we redirect to lat,lon?
+ is $mech->uri->path, '/around', "still on /around";
+ is_deeply { $mech->uri->query_form },
+ { lat => 51.4998246332569, lon => -0.140137309739907, },
+ "lat,lon correctly set";
+
+ # was it a 301?
+ is $mech->res->code, 200, "got 200 for final destination";
+ is $mech->res->previous->code, 301, "got 301 for redirect";
+
+};
+
+done_testing();