From 524f4c3fe1903d2732a0b4483c7ddc3b10222b80 Mon Sep 17 00:00:00 2001 From: Eitaro Fukamachi Date: Tue, 9 Feb 2016 22:50:40 +0900 Subject: [PATCH] Add tests for Lack.Session.Store.Redis. --- t/session/store/redis.lisp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/session/store/redis.lisp b/t/session/store/redis.lisp index 03268ea..d8f2b01 100644 --- a/t/session/store/redis.lisp +++ b/t/session/store/redis.lisp @@ -104,11 +104,23 @@ (let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session))))))) (is body '("Hello, 深町英太郎! You've been here for 2th times!"))) + (sleep 2) + + (let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session))))))) + (is body '("Hello, 深町英太郎! You've been here for 3th times!") + "Still the session is alive")) + + (sleep 2) + + (let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session))))))) + (is body '("Hello, 深町英太郎! You've been here for 4th times!") + "Reset the expiration when accessed")) + (sleep 3) (let ((body (nth 2 (funcall app (generate-env "/" :cookies `(("lack.session" . ,session))))))) (is body '("Hello, 深町英太郎! You've been here for 1th times!") - "Session has expired after 3 seconds")))) + "Session has expired after 3 seconds since the last access")))) (let ((redis::*connection* *connection*)) (is (length (red:keys (format nil "~A:*" *namespace*)))