@@ -137,17 +137,45 @@ var _ = Describe("NewSessionStore", func() {
138 SessionStoreInterfaceTests := func(persistent bool) {
138 SessionStoreInterfaceTests := func(persistent bool) {
139 Context("when Save is called", func() {
139 Context("when Save is called", func() {
140+ Context("with no existing session", func() {
140− BeforeEach(func() {
141+ BeforeEach(func() {
141− err := ss.Save(response, request, session)
142+ err := ss.Save(response, request, session)
142− Expect(err).ToNot(HaveOccurred())
143+ Expect(err).ToNot(HaveOccurred())
145− It("sets a `set-cookie` header in the response", func() {
146+ It("sets a `set-cookie` header in the response", func() {
146− Expect(response.Header().Get("set-cookie")).ToNot(BeEmpty())
147+ Expect(response.Header().Get("set-cookie")).ToNot(BeEmpty())
150+ It("Ensures the session CreatedAt is not zero", func() {
151+ Expect(session.CreatedAt.IsZero()).To(BeFalse())
149− It("Ensures the session CreatedAt is not zero", func() {
155+ Context("with an expired saved session", func() {
150− Expect(session.CreatedAt.IsZero()).To(BeFalse())
156+ var err error
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())
164+ By("and clearing the session")
165+ for _, c := range saveResp.Result().Cookies() {
166+ request.AddCookie(c)
168+ clearResp := httptest.NewRecorder()
169+ err = ss.Clear(clearResp, request)
170+ Expect(err).ToNot(HaveOccurred())
172+ By("then saving a request with the cleared session")
173+ err = ss.Save(response, request, session)
176+ It("no error should occur", func() {
177+ Expect(err).ToNot(HaveOccurred())
153 CheckCookieOptions()
181 CheckCookieOptions()