Skip to content

Instantly share code, notes, and snippets.

@jaycfields
Created October 31, 2012 17:42
Show Gist options
  • Save jaycfields/3988585 to your computer and use it in GitHub Desktop.
Save jaycfields/3988585 to your computer and use it in GitHub Desktop.
tests that redef state
(ns blog-expectations
(:use expectations
[blog :as b]))
(expect {"CNN" {:src "CNN" :headline "Election Update"}
"NY Times" {:src "NY Times" :headline "Movie Guide"}}
(with-redefs [b/all-updates (atom {})
b/last-update (atom {})]
(b/process-update {:src "NY Times" :headline "Market News"})
(b/process-update {:src "CNN" :headline "Election Update"})
(b/process-update {:src "NY Times" :headline "Movie Guide"})
@last-update))
(expect {"CNN" [{:src "CNN", :headline "Election Update"}]
"NY Times" [{:src "NY Times", :headline "Movie Guide"}
{:src "NY Times", :headline "Market News"}]}
(with-redefs [b/all-updates (atom {})
b/last-update (atom {})]
(b/process-update {:src "NY Times" :headline "Market News"})
(b/process-update {:src "CNN" :headline "Election Update"})
(b/process-update {:src "NY Times" :headline "Movie Guide"})
@all-updates))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment