add test for Store::CHI
Masahiro Chiba [Sat, 12 Dec 2009 22:49:27 +0000 (06:49 +0800)]
Makefile.PL
t/005_basic_w_chi_store.t [new file with mode: 0644]

index cd51495..4d5ea9b 100644 (file)
@@ -15,6 +15,7 @@ requires 'Digest::SHA'      => '0';
 
 # things the tests need
 build_requires 'Test::More' => '0.88';
+build_requires 'Test::Requires' => '0';
 
 tests_recursive;
 auto_install;
diff --git a/t/005_basic_w_chi_store.t b/t/005_basic_w_chi_store.t
new file mode 100644 (file)
index 0000000..97e624d
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::Requires 'CHI';
+
+use Test::More;
+
+use Plack::Request;
+use Plack::Session;
+use Plack::Session::State;
+use Plack::Session::Store::CHI;
+
+use t::lib::TestSession;
+
+t::lib::TestSession::run_all_tests(
+    store           => Plack::Session::Store::CHI->new( chi => CHI->new(driver => 'Memory', datastore => {}) ),
+    state           => Plack::Session::State->new,
+    request_creator => sub {
+        open my $in, '<', \do { my $d };
+        my $env = {
+            'psgi.version'    => [ 1, 0 ],
+            'psgi.input'      => $in,
+            'psgi.errors'     => *STDERR,
+            'psgi.url_scheme' => 'http',
+            SERVER_PORT       => 80,
+            REQUEST_METHOD    => 'GET',
+        };
+        my $r = Plack::Request->new( $env );
+        $r->parameters( @_ );
+        $r;
+    },
+);
+
+
+done_testing;