Skip to content

Instantly share code, notes, and snippets.

@erez-rabih
Created April 21, 2019 06:21
Show Gist options
  • Save erez-rabih/e7ba026a00a8b3fa306094f7c1de1e30 to your computer and use it in GitHub Desktop.
Save erez-rabih/e7ba026a00a8b3fa306094f7c1de1e30 to your computer and use it in GitHub Desktop.
redis mock
(ns test.redis-mock)
(defn mock-redis [f]
(let [redis-storage (atom {})]
(with-redefs [redis/set (fn [key value] (swap! redis-storage assoc key value))
redis/get (fn [key] (get @redis-storage key))]
(f))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment