Changes for clojure.core/with-redefs-fn

avasenin on Fri, 09 Nov 2012
(ns http)

(defn post [url]
  {:body "Hello world"})

(ns app
  (:require [clojure.test :refer [run-tests]]))

(deftest is-a-fn
  (with-redefs-fn {#'http/post (fn [url] {:body "Hello world again"})}
    #(is (= {:body "Hello world again"} (http/post "http://service.com/greet")))))

(run-tests) ;; test is passing
johnnyluu on Thu, 11 Oct 2012
(ns http)

(defn post [url]
  {:body "Hello world"})

(ns app
  (:require [clojure.test :refer [run-tests]]))

(deftest is-a-fn
  (with-redefs-fn {http/post (fn [url] {:body "Hello world again"})}
    #(is (= {:body "Hello world again"} (http/post "http://service.com/greet")))))

(run-tests) ;; test is passing
johnnyluu on Thu, 11 Oct 2012
(ns http)

(defn post [url]
  {:body "Hello world"})

(ns app
  (:require [clojure.test :refer [run-tests]]))

(deftest is-a-fn
  (with-redefs-fn {http/post (fn [url] {:body "Goodbye world again"})}
    #(is (= {:body "Goodbye world again"} (http/post "http://service.com/greet")))))

(run-tests) ;; test is passing