Skip to content

Instantly share code, notes, and snippets.

@martinklepsch
Created January 7, 2015 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinklepsch/6cdb6ee4c5516b6186ae to your computer and use it in GitHub Desktop.
Save martinklepsch/6cdb6ee4c5516b6186ae to your computer and use it in GitHub Desktop.
(deftest notification-unsuccessful
(testing "Notification url returns error"
(let [requests (atom 0)]
(with-fake-http [test-uri (fn [orig-fn opts callback]
(swap! requests inc)
{:status 500 :body "ok"})]
(n/notify test-uri #(= % "ok") :wait-times [1 2 3 4])
(Thread/sleep 100)
(is (= 5 @requests)))))
(testing "Notification check-fn not fulfilled"
(let [requests (atom 0)]
(with-fake-http [test-uri (fn [orig-fn opts callback]
(swap! requests inc)
{:status 200 :body "unexpected"})]
(n/notify test-uri #(= % "ok") :wait-times [1 2 3 4])
(Thread/sleep 100)
(is (= 5 @requests))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment