summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-27 20:36:11 +0200
committerfranck cuny <franck@lumberjaph.net>2010-05-27 20:36:11 +0200
commitc8601d93f056efcc018587a6c79cde2f61aeb224 (patch)
tree3e04478f483f5aff3f62140bd627a1ed7b437f2a /t
parentinitial commit (diff)
downloadplack-middleware-i18n-c8601d93f056efcc018587a6c79cde2f61aeb224.tar.gz
detect locale from http headers
Diffstat (limited to 't')
-rw-r--r--t/01_basic.t15
1 files changed, 10 insertions, 5 deletions
diff --git a/t/01_basic.t b/t/01_basic.t
index 630bd55..c18f862 100644
--- a/t/01_basic.t
+++ b/t/01_basic.t
@@ -8,20 +8,25 @@ use HTTP::Request::Common;
my $handler = builder {
enable "i18n";
sub {
- [ '200', ['Content-Type' => 'text/html', 'Accept-Language' => 'fr'],
- ['Hello world']
+ my $env = shift;
+ [ '200',
+ ['Content-Type' => 'text/html',],
+ ['locale is ' . $env->{'psgix.locale'}]
];
};
};
test_psgi
- app => $handler,
- client => sub {
+ app => $handler,
+ client => sub {
my $cb = shift;
{
my $req = GET "http://localhost/";
+ $req->header('Accept-Language' => 'fr-FR,de;q=0.8');
ok my $res = $cb->($req);
+ is $res->content, 'locale is fr';
}
-};
+ };
done_testing();
+