[Catalyst-commits] r6583 - trunk/Catalyst-Plugin-I18N/t

bricas at dev.catalyst.perl.org bricas at dev.catalyst.perl.org
Thu Jul 19 16:25:14 GMT 2007


Author: bricas
Date: 2007-07-19 16:25:13 +0100 (Thu, 19 Jul 2007)
New Revision: 6583

Modified:
   trunk/Catalyst-Plugin-I18N/t/04live.t
Log:
test for language fallback

Modified: trunk/Catalyst-Plugin-I18N/t/04live.t
===================================================================
--- trunk/Catalyst-Plugin-I18N/t/04live.t	2007-07-19 12:47:48 UTC (rev 6582)
+++ trunk/Catalyst-Plugin-I18N/t/04live.t	2007-07-19 15:25:13 UTC (rev 6583)
@@ -6,7 +6,7 @@
 use FindBin;
 use lib "$FindBin::Bin/lib";
 
-use Test::More tests => 20;
+use Test::More tests => 24;
 use Catalyst::Test 'TestApp';
 
 BEGIN {
@@ -99,6 +99,21 @@
         is( $response->code, 200, 'Response Code' );
 
         is( $response->content, $expected, 'Content OK' );
-    }
+    }
+
+    # test fallback (i.e. fr-ca => fr)
+    {
+        my $expected = 'fr';
+        my $request  =
+          HTTP::Request->new( GET => 'http://localhost:3000/current_language' );
 
+        $request->header( 'Accept-Language' => 'fr-ca' );
+
+        ok( my $response = request($request), 'Request' );
+        ok( $response->is_success, 'Response Successful 2xx' );
+        is( $response->code, 200, 'Response Code' );
+
+        is( $response->content, $expected, 'Content OK' );
+    }
+
 }




More information about the Catalyst-commits mailing list