Writing a high-level integration test
I've always been weary of writing integration tests in the manner of unit tests because when they fail they're difficult to diagnose. All that a failed unit-style integration test tells us is that something, somewhere, broke down. In an ideal world, you would also have a unit test, which when an integration test fails, will also fail. However, rare is the team filled with unit test passion such that a beautiful pairing of failures exist. So, while we will see how we can use James Reeves' ring-mock
to do a full-fledged integration test, we must also keep in mind that integration tests on their own are not enough.
For this example, we are going to add an additional test to the hipstr.test.handler
namespace that was generated by Luminus when we generated our project. You'll see something like this:
(ns hipstr.test.handler (:use clojure.test ring.mock.request hipstr.handler)) (deftest test-app (testing "main route" (let [response...