From 6dd4a1d1053ceeac0ed75f6655e12ea9b018a55a Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 14 Jun 2014 17:55:02 -0400 Subject: [PATCH] fix failing tests --- test/clj_jtwig/core_test.clj | 60 +++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/test/clj_jtwig/core_test.clj b/test/clj_jtwig/core_test.clj index d24cb17..24b59f6 100644 --- a/test/clj_jtwig/core_test.clj +++ b/test/clj_jtwig/core_test.clj @@ -28,17 +28,25 @@ {"name" "Bob"}) "Hello Bob!") "passing a model-map where the keys are strings already") - (is (= (render "Hello {{ name }}!" - {"name" "Bob"} - {:skip-model-map-stringify? true}) - "Hello Bob!") - "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") - (is (thrown? - ClassCastException - (render "Hello {{ name }}!" - {:name "Bob"} - {:skip-model-map-stringify? true})) - "passing a model-map where the keys are keywords and try skipping auto stringifying the keys"))) + (do + (set-options! :stringify-keys false) + + (is (= (render "Hello {{ name }}!" + {"name" "Bob"}) + "Hello Bob!") + "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") + + (set-options! :stringify-keys true)) + (do + (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 (testing "Passing Clojure data structures to JTwigContext's" @@ -108,14 +116,22 @@ {"name" "Bob"}) "Hello Bob from a file!") "passing a model-map where the keys are strings already") - (is (= (render-file test-filename - {"name" "Bob"} - {:skip-model-map-stringify? true}) - "Hello Bob from a file!") - "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") - (is (thrown? - ClassCastException - (render-file test-filename - {:name "Bob"} - {:skip-model-map-stringify? true})) - "passing a model-map where the keys are keywords and try skipping auto stringifying the keys")))) + (do + (set-options! :stringify-keys false) + + (is (= (render-file test-filename + {"name" "Bob"}) + "Hello Bob from a file!") + "passing a model-map where the keys are strings already and we want to skip auto stringifying bbb") + + (set-options! :stringify-keys true)) + (do + (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)))))