Created
November 29, 2012 19:34
-
-
Save nathanic/4171294 to your computer and use it in GitHub Desktop.
validation test example
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
(fact "answers get validated" | |
(let [ctx {:state :composing | |
:players #{"data" "geordi" "picard"} | |
:submissions {} | |
:letters [\S \I \T \M] | |
;:live? true | |
}] | |
(submit-answer ctx "data" "sock it to me") | |
=> (contains {:submissions {"data" "sock it to me"}}) | |
; you can't copy someone else's answer | |
(-> ctx | |
(submit-answer "data" "sock it to me") | |
(submit-answer "geordi" "Sock It To Me")) | |
=not=> (contains {:submissions {"geordi" "Sock It To Me"}}) | |
(submit-answer ctx "data" "some invalid stuff that doesn't work") | |
=not=> (contains {:submissions {"data" "some invalid stuff that doesn't work"}}) | |
(submit-answer ctx "non-player" "whatever") | |
=not=> (contains {:submissions {"non-player" "whatever"}}) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment