Skip to content

Instantly share code, notes, and snippets.

@jamesmacaulay
Created February 3, 2013 19:02
Show Gist options
  • Save jamesmacaulay/4703171 to your computer and use it in GitHub Desktop.
Save jamesmacaulay/4703171 to your computer and use it in GitHub Desktop.
(ns jasmine.core)
(def expect (.-expect js/window))
(.beforeEach js/window (fn []
(this-as spec
(.addMatchers spec (js-obj
"to_be" #(this-as expectation
(= % (.-actual expectation))))))))
(defn to-be [this other] (.to_be this other))
(ns jasmine.macros)
(defmacro describe [string & exprs]
`(.describe js/window ~string (fn [] ~@exprs)))
(defmacro it [string & exprs]
`(.it js/window ~string (fn [] ~@exprs)))
(ns jasmine.test.core
(:use [jasmine.core :only [expect to-be]])
(:use-macros [jasmine.macros :only [describe it]]))
(describe "true"
(it "is true"
(-> (expect true) (to-be true)))
(it "is not false"
(-> (expect true) (to-be (not false)))))
(describe "to-be"
(it "uses clojure equality"
(-> (expect []) (to-be '()))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment