diff options
Diffstat (limited to 't/app')
-rw-r--r-- | t/app/uri_for.t | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/t/app/uri_for.t b/t/app/uri_for.t index 309c3a3b2..67acbc235 100644 --- a/t/app/uri_for.t +++ b/t/app/uri_for.t @@ -35,6 +35,20 @@ my $fgm_c = FixMyStreet::App->new( } ); +my $reh_en_c = FixMyStreet::App->new( + { + request => Catalyst::Request->new( + { + base => URI->new('http://reportemptyhomes.com/'), + uri => URI->new('http://reportemptyhomes.com/test_namespace') + } + ), + namespace => 'test_namespace', + } +); +$reh_en_c->setup_request(); + + is( $fms_c->uri_for('/bar/baz') . "", 'http://www.fixmystreet.com/bar/baz', @@ -60,6 +74,33 @@ is( 'FiksGataMi url with lat not zoom' ); +like( + $reh_en_c->uri_for_email( '/foo' ), + qr{^http://en.}, + 'adds en to retain language' +); + +# instantiate this here otherwise sets locale to cy and breaks test +# above +my $reh_cy_c = FixMyStreet::App->new( + { + request => Catalyst::Request->new( + { + base => URI->new('http://cy.reportemptyhomes.com/'), + uri => URI->new('http://cy.reportemptyhomes.com/test_namespace') + } + ), + namespace => 'test_namespace', + } +); +$reh_cy_c->setup_request(); + +like( + $reh_cy_c->uri_for_email( '/foo' ), + qr{^http://cy.}, + 'retains language' +); + ## Should really test the cities but we'd need to fake up too much of the # request. Following code starts to do this but is not complete. Instead better # to test that the cities produces the correct urls by looking at the html |