Skip to content

Instantly share code, notes, and snippets.

@joshrp
Created March 9, 2015 00:36
Show Gist options
  • Save joshrp/6546b6920c60998bdee7 to your computer and use it in GitHub Desktop.
Save joshrp/6546b6920c60998bdee7 to your computer and use it in GitHub Desktop.
(ns pr-stats.models.github-pr
(:require
[clj-http.client :as client]
[clojure.core.async :as a :refer [>! <! >!! <!! go chan]]
)
(:gen-class))
(defn getClientGet
[]
client/get)
(defn getPull
[id]
(let [result-chan (chan)]
(go
(let [resp ((getClientGet) "https://api.github.com/repos/twbs/bootstrap/pulls")]
(>! result-chan (resp :body))
)
)
result-chan
)
)
(ns pr-stats.models.github-pr-test
(:use midje.sweet)
(:require
[pr-stats.models.github-pr :refer :all]
[clojure.core.async
:as a
:refer [>! <! <!!]]
)
)
(fact "The thing will call"
(<!! (getPull 1)) => "foo"
(provided (getClientGet) => (fn fakeClient
[& url] {
:status 200
:headers []
:body "foo"
}
))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment