Skip to content
master
Go to file
Code
This branch is 54 commits ahead, 1 commit behind weavejester:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

Ring-Mock

Build Status

Ring-Mock is a library for creating Ring request maps for testing purposes.

Installation

Add the following development dependency to your project.clj file:

[ring/ring-mock "0.4.0"]

Documentation

Example

(ns your-app.core-test
  (:require [clojure.test :refer :all]
            [your-app.core :refer :all]
            [ring.mock.request :as mock]))

(deftest your-handler-test
  (is (= (your-handler (mock/request :get "/doc/10"))
         {:status  200
          :headers {"content-type" "text/plain"}
          :body    "Your expected result"})))
          
(deftest your-json-handler-test
  (is (= (your-handler (-> (mock/request :post "/api/endpoint")
                           (mock/json-body {:foo "bar"})))
         {:status  201
          :headers {"content-type" "application/json"}
          :body    {:key "your expected result"}})))

License

Copyright © 2019 James Reeves

Distributed under the MIT License.

About

Library to create mock Ring requests for unit tests

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.