Merge pull request #7 from tokuhirom/master
[catagits/Web-Session.git] / t / 015_cookie_options_mw.t
index b373c46..8e37715 100644 (file)
@@ -10,7 +10,8 @@ my $app = sub {
 
     $env->{'psgix.session'}->{counter} = 1;
 
-    $env->{'psgix.session.options'}{path}     = '/foo';
+    my $path = $env->{PATH_INFO} =~ /with_path/ ? "/foo" : undef;
+    $env->{'psgix.session.options'}{path}     = $path;
     $env->{'psgix.session.options'}{domain}   = '.example.com';
     $env->{'psgix.session.options'}{httponly} = 1;
 
@@ -23,6 +24,9 @@ test_psgi $app, sub {
     my $cb = shift;
 
     my $res = $cb->(GET "http://localhost/");
+    like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; HttpOnly/;
+
+    $res = $cb->(GET "http://localhost/with_path");
     like $res->header('Set-Cookie'), qr/plack_session=\w+; domain=.example.com; path=\/foo; HttpOnly/;
 };