Last active
June 15, 2019 05:14
-
-
Save erez-rabih/074156d42393db2397069188e53b1617 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest register-test | |
(let [email "[email protected]" | |
response (request :post "/register" {:email email})] | |
(testing "http response" | |
(testing "should return 201 status code" | |
(is (= 201 (:status response)))) | |
(testing "should return the created user in response body" | |
(is (= email (-> response :body :email))) | |
(is (integer? (-> response :body :id)))) | |
(testing "should not return the confirmation token in the response body" | |
(is (not (contains? (:body response) :confirmation_token))))) | |
(testing "should create the user in the database" | |
(let [created-user (user/find-by-email email)] | |
(is (not (nil? created-user))) | |
(testing "should have a confirmation token" | |
(is (not (nil? (:confirmation_token created-user))))))) | |
(testing "should send a confirmation email" | |
(is (confirmation-sent? email))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment