            (u/sign-in ...user-store...)) => (contains {:status  302 :headers {"Location" ...return-to-url...}
                                                        :session {:access_token ...token... :user-login ...user-login...}})
       (provided
-       (user/authenticate-and-retrieve-user ...user-store... email password) => {:login ...user-login...}
+       (user/authenticate-and-retrieve-user ...user-store... default-email default-password) => {:login ...user-login...}
        (cl-token/create-token @storage/token-store nil {:login ...user-login...}) => {:token ...token...}))
 
 (facts "about sign-in validation errors"

             (against-background
               (uuid/uuid) => confirmation-id)
             (let [user-store (m/create-memory-store)
                   response (->> (th/create-request :post (routes/path :register-user) register-user-params)
                                 (u/register-user user-store))
                   registered-user (user/retrieve-user user-store email)]
               (:email @most-recent-email) => email
               (:body @most-recent-email) => (contains {:confirmation-id confirmation-id})))

       (fact "when user email is send, flash message is assoc-ed in redirect"
             (against-background
               (uuid/uuid) => confirmation-id)
             (let [user-store (m/create-memory-store)
                   response (->> (th/create-request :post (routes/path :register-user) register-user-params)
                                 (u/register-user user-store))]
               (:flash response) => :confirm-email-sent)))

(facts "about registration validation errors"
       (fact "email must not be a duplicate"
             (let [user-store (m/create-memory-store)
                   html-response (->> (th/create-request :post "/register" register-user-params)
                                      (u/register-user user-store)
                                      :body
                                      html/html-snippet)]
               (-> (html/select html-response [:.form-row--validation-error])
                   first
                   :attrs
                   :class)) => (contains "clj--registration-email")
             (provided
               (v/validate-registration register-user-params anything) => {:email :duplicate}
               (cl-user/new-user anything anything) => anything :times 0
               (cl-user/store-user anything anything) => anything :times 0))

       (fact "user isn't saved to the database if email is invalid"
             (let [user-store (m/create-memory-store)]

                                                       :session {:user-login   ...user-login...
                                                                 :access_token ...token...}})
      (provided
       (user/authenticate-and-retrieve-user ...user-store... default-email default-password) => {:login ...user-login...}
       (cl-token/create-token @storage/token-store nil {:login ...user-login...}) => {:token ...token...}))

(fact "signed-in? returns true only when user-login and access_token are in the session"
