fix failing tests

This commit is contained in:
Gered 2014-06-14 17:55:02 -04:00
parent e0b21871a6
commit 6dd4a1d105

View file

@ -28,17 +28,25 @@
{"name" "Bob"}) {"name" "Bob"})
"Hello Bob!") "Hello Bob!")
"passing a model-map where the keys are strings already") "passing a model-map where the keys are strings already")
(is (= (render "Hello {{ name }}!" (do
{"name" "Bob"} (set-options! :stringify-keys false)
{:skip-model-map-stringify? true})
"Hello Bob!") (is (= (render "Hello {{ name }}!"
"passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") {"name" "Bob"})
(is (thrown? "Hello Bob!")
ClassCastException "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb")
(render "Hello {{ name }}!"
{:name "Bob"} (set-options! :stringify-keys true))
{:skip-model-map-stringify? true})) (do
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys"))) (set-options! :stringify-keys false)
(is (thrown?
ClassCastException
(render "Hello {{ name }}!"
{:name "Bob"}))
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")
(set-options! :stringify-keys true))))
(deftest passing-model-map-data (deftest passing-model-map-data
(testing "Passing Clojure data structures to JTwigContext's" (testing "Passing Clojure data structures to JTwigContext's"
@ -108,14 +116,22 @@
{"name" "Bob"}) {"name" "Bob"})
"Hello Bob from a file!") "Hello Bob from a file!")
"passing a model-map where the keys are strings already") "passing a model-map where the keys are strings already")
(is (= (render-file test-filename (do
{"name" "Bob"} (set-options! :stringify-keys false)
{:skip-model-map-stringify? true})
"Hello Bob from a file!") (is (= (render-file test-filename
"passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") {"name" "Bob"})
(is (thrown? "Hello Bob from a file!")
ClassCastException "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb")
(render-file test-filename
{:name "Bob"} (set-options! :stringify-keys true))
{:skip-model-map-stringify? true})) (do
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")))) (set-options! :stringify-keys false)
(is (thrown?
ClassCastException
(render-file test-filename
{:name "Bob"}))
"passing a model-map where the keys are keywords and try skipping auto stringifying the keys")
(set-options! :stringify-keys true)))))