to make git include the t/tmp dir
[catagits/Web-Session.git] / t / 004_basic_file_w_customs.t
CommitLineData
f331b3e0 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use File::Spec;
6
7use Test::More;
8
9BEGIN {
10 eval "use YAML";
11 plan skip_all => "This test requires YAML" if $@;
12}
13
14use Plack::Request;
15use Plack::Session;
16use Plack::Session::State::Cookie;
17use Plack::Session::Store::File;
18
19use t::lib::TestSession;
20
21my $TMP = File::Spec->catdir('t', 'tmp');
22
23t::lib::TestSession::run_all_tests(
24 store => Plack::Session::Store::File->new(
25 dir => $TMP,
26 serializer => sub { YAML::DumpFile( reverse @_ ) }, # YAML takes it's args the opposite of Storable
27 deserializer => sub { YAML::LoadFile( @_ ) },
28 ),
29 state => Plack::Session::State->new,
30 request_creator => sub {
31 open my $in, '<', \do { my $d };
32 my $env = {
33 'psgi.version' => [ 1, 0 ],
34 'psgi.input' => $in,
35 'psgi.errors' => *STDERR,
36 'psgi.url_scheme' => 'http',
37 SERVER_PORT => 80,
38 REQUEST_METHOD => 'GET',
39 };
40 my $r = Plack::Request->new( $env );
41 $r->parameters( @_ );
42 $r;
43 },
44);
45
46unlink $_ foreach glob( File::Spec->catdir($TMP, '*') );
47
48done_testing;