I have a web service that uses Korma for interacting with my db. To mock data for unit tests I want to re-bind korma.core/select to return known data and not hit a db.
Currently I have a db ns:
(:require [korma.core :refer :all]
With a function 'func-select' that calls korma.core/select
And a test ns:
(ns ad-gallery-services.core-test
(:require [clojure.test :refer :all]
[ad-gallery-services.db :refer :all]
[ad-gallery-services.web :refer :all]))
(deftest func-select-test
(testing "Return nil if select returns empty"
(with-redefs [korma.core/select (fn [& _] [])]
(require 'ad-gallery-services.db :reload)
However, it keeps throwing the exception:
ArityException Wrong number of args (1) passed to: core$where
Why is it even evaluating 'where', and (most importantly) how can I mock this data?