Created
February 3, 2013 19:02
-
-
Save jamesmacaulay/4703171 to your computer and use it in GitHub Desktop.
This file contains 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 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)) |
This file contains 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 jasmine.macros) | |
(defmacro describe [string & exprs] | |
`(.describe js/window ~string (fn [] ~@exprs))) | |
(defmacro it [string & exprs] | |
`(.it js/window ~string (fn [] ~@exprs))) |
This file contains 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 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