Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Live or dead (mocked) ring requests for testing with the same ring.mock.request API

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

ring-zombie

A Clojure library designed to test ring applications in live or dead (mocked) mode.

Latest version

1.0.2

Usage

Add ring-zombie to your project.clj file:

(defproject foo "1.0.0"
  :profiles {:test {:dependencies [[ring-zombie "1.0.1"]]}})

In your tests, set your handler function and your root URI.

clojure.test

(ns foo.core-test
  (:require [clojure.test :refer :all]
            [foo.core :refer :all]
            [ring-zombie.core :as zombie]))

(defn setup-ring-zombie [tests]
  (zombie/set-root-uri "http://localhost:8080/")
  (zombie/set-handler #'handler-fn)
  (tests))

(use-fixtures :once setup-ring-zombie)

Midje

(ns foo.t-core
  (:require [midje.sweet :refer :all]
            [foo.core :refer :all]
            [ring-zombie.core :as zombie]))

(with-state-changes [(before :facts
                             (do (zombie/set-root-uri "http://localhost:8080/")
                                 (zombie/set-handler #'handler-fn)))]

  (fact...))

Now you can run your tests in live or mock mode.

Live: RING_ZOMBIE=live lein [test|midje]

Mock: lein [test|midje]

Changes

  • 1.0.2 - fix GitHub URL in project.clj
  • 1.0.1 - put some actual content into the README.md file
  • 1.0.0 - initial release to Clojars

License

Copyright © 2013 Wes Morgan

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.