Created
June 1, 2012 22:41
-
-
Save ahjones/2855541 to your computer and use it in GitHub Desktop.
Rest client driver with Clojure and Midje
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
(ns logging.web-test | |
(:use midje.sweet | |
ring.mock.request | |
my-thing.web) | |
(:import [com.github.restdriver.clientdriver | |
ClientDriverFactory | |
ClientDriverRule | |
RestClientDriver])) | |
(def driver (.. (ClientDriverFactory.) (createClientDriver 8123))) | |
(fact (app (body (request :post "/thing") (slurp "test/resources/valid.json"))) | |
=> (contains {:status 201}) | |
(against-background | |
(around :contents | |
(do | |
(.addExpectation driver | |
(RestClientDriver/onRequestTo "/resource") | |
(RestClientDriver/giveEmptyResponse)) | |
?form | |
(try (.verify driver) (catch Exception e (fact e => nil))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment