Skip to content

Instantly share code, notes, and snippets.

@wilkerlucio
Created July 16, 2014 15:28
Show Gist options
  • Select an option

  • Save wilkerlucio/35d75b73b89f2a530f3d to your computer and use it in GitHub Desktop.

Select an option

Save wilkerlucio/35d75b73b89f2a530f3d to your computer and use it in GitHub Desktop.
(ns joy.unit-testing
(:require [joy.futures :as joy]))
(def stubbed-feed-children
(constantly [{:content [{:tag :title
:content ["Stub"]}]}]))
(defn count-feed-entries [url]
(count (joy/feed-children url)))
(count-feed-entries "http://blog.fogus.me/feed/")
;;=> 5
(with-redefs [joy/feed-children stubbed-feed-children] (count-feed-entries "dummy url"))
;;=> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment