Created
March 9, 2015 00:36
-
-
Save joshrp/6546b6920c60998bdee7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 | |
) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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