File: 14_session_domain.t

package info (click to toggle)
libdancer-perl 1.3202%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,408 kB
  • ctags: 638
  • sloc: perl: 7,215; xml: 1,977; sh: 51; makefile: 29; sql: 5
file content (34 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env perl

use strict;
use warnings;

use Dancer ':syntax', ':tests';
use Dancer::Session::Simple;
use Test::More tests => 2;


my $Session_Name = Dancer::Session::Simple->session_name;

note "session_domain off"; {
    set session => "simple";
    session foo => "bar";

    my $session_cookie = Dancer::Cookies->cookies->{ $Session_Name };
    ok !$session_cookie->domain;
}


note "session_domain on"; {
    delete Dancer::Cookies->cookies->{ $Session_Name };

    my $test_domain = '.test-domain.com';

    set session         => "simple";
    set session_domain  => $test_domain;

    session up => "down";

    my $session_cookie = Dancer::Cookies->cookies->{ $Session_Name };
    is $session_cookie->domain => $test_domain;
}