@@ -137,17 +137,45 @@ var _ = Describe("NewSessionStore", func() {
137137
138138 SessionStoreInterfaceTests := func(persistent bool) {
139139 Context("when Save is called", func() {
140− BeforeEach(func() {
141− err := ss.Save(response, request, session)
142− Expect(err).ToNot(HaveOccurred())
143− })
140+ Context("with no existing session", func() {
141+ BeforeEach(func() {
142+ err := ss.Save(response, request, session)
143+ Expect(err).ToNot(HaveOccurred())
144+ })
144145
145− It("sets a `set-cookie` header in the response", func() {
146− Expect(response.Header().Get("set-cookie")).ToNot(BeEmpty())
146+ It("sets a `set-cookie` header in the response", func() {
147+ Expect(response.Header().Get("set-cookie")).ToNot(BeEmpty())
148+ })
149+
150+ It("Ensures the session CreatedAt is not zero", func() {
151+ Expect(session.CreatedAt.IsZero()).To(BeFalse())
152+ })
147153 })
148154
149− It("Ensures the session CreatedAt is not zero", func() {
150− Expect(session.CreatedAt.IsZero()).To(BeFalse())
155+ Context("with an expired saved session", func() {
156+ var err error
157+ BeforeEach(func() {
158+ By("saving a session")
159+ req := httptest.NewRequest("GET", "http://example.com/", nil)
160+ saveResp := httptest.NewRecorder()
161+ err = ss.Save(saveResp, req, session)
162+ Expect(err).ToNot(HaveOccurred())
163+
164+ By("and clearing the session")
165+ for _, c := range saveResp.Result().Cookies() {
166+ request.AddCookie(c)
167+ }
168+ clearResp := httptest.NewRecorder()
169+ err = ss.Clear(clearResp, request)
170+ Expect(err).ToNot(HaveOccurred())
171+
172+ By("then saving a request with the cleared session")
173+ err = ss.Save(response, request, session)
174+ })
175+
176+ It("no error should occur", func() {
177+ Expect(err).ToNot(HaveOccurred())
178+ })
151179 })
152180
153181 CheckCookieOptions()