Commit | Line | Data |
442b79a8 |
1 | use strict; |
2 | use Test::More; |
3 | |
4 | my $time = 1264843167; |
5 | BEGIN { *CORE::GLOBAL::time = sub() { $time } } |
6 | use Plack::Session::State::Cookie; |
7 | |
8 | my $st = Plack::Session::State::Cookie->new; |
9 | $st->domain('.example.com'); |
10 | $st->secure(1); |
11 | $st->expires(3600); |
12 | $st->path('/cgi-bin'); |
13 | |
14 | is_deeply +{ $st->merge_options(id => 123) }, |
15 | { domain => '.example.com', secure => 1, expires => $time + 3600, path => '/cgi-bin' }; |
16 | |
17 | is_deeply +{ $st->merge_options(id => 123, path => '/', domain => '.perl.org') }, |
18 | { domain => '.perl.org', secure => 1, expires => $time + 3600, path => '/' }; |
19 | |
20 | is_deeply +{ $st->merge_options(id => 123, expires => $time + 1, secure => 0) }, |
21 | { domain => '.example.com', secure => 0, expires => $time + 1, path => '/cgi-bin' }; |
22 | |
23 | done_testing; |