use midje for testing per #57
This commit is contained in:
parent
cf48e336da
commit
349a4a2201
@ -14,5 +14,6 @@
|
|||||||
[lein-ring "0.9.7"]]
|
[lein-ring "0.9.7"]]
|
||||||
:hooks [environ.leiningen.hooks]
|
:hooks [environ.leiningen.hooks]
|
||||||
:uberjar-name "pronouns-standalone.jar"
|
:uberjar-name "pronouns-standalone.jar"
|
||||||
:profiles {:production {:env {:production true}}}
|
:profiles {:production {:env {:production true}}
|
||||||
|
:dev {:dependencies [[midje "1.6.3"]]}}
|
||||||
:ring {:handler pronouns.web/app})
|
:ring {:handler pronouns.web/app})
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
[items]
|
[items]
|
||||||
(let [c (count items)]
|
(let [c (count items)]
|
||||||
(cond
|
(cond
|
||||||
(<= c 1) (first items)
|
(<= c 1) (or (first items) "")
|
||||||
(= c 2) (s/join " and " items)
|
(= c 2) (s/join " and " items)
|
||||||
:else (str (s/join ", " (butlast items)) ", and " (last items)))))
|
:else (str (s/join ", " (butlast items)) ", and " (last items)))))
|
||||||
|
|
||||||
@ -122,7 +122,7 @@
|
|||||||
[:meta {:name "viewport" :content "width=device-width"}]
|
[:meta {:name "viewport" :content "width=device-width"}]
|
||||||
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
||||||
[:body
|
[:body
|
||||||
(title-block title)
|
(header-block title)
|
||||||
(map #(apply examples-block %) pronoun-declensions)
|
(map #(apply examples-block %) pronoun-declensions)
|
||||||
(footer-block)]])))
|
(footer-block)]])))
|
||||||
|
|
||||||
@ -149,7 +149,7 @@
|
|||||||
[:meta {:name "viewport" :content "width=device-width"}]
|
[:meta {:name "viewport" :content "width=device-width"}]
|
||||||
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
||||||
[:body
|
[:body
|
||||||
(title-block title)
|
(header-block title)
|
||||||
[:div {:class "section table"}
|
[:div {:class "section table"}
|
||||||
[:p "pronoun.is is a website for personal pronoun usage examples"]
|
[:p "pronoun.is is a website for personal pronoun usage examples"]
|
||||||
[:p "here are some pronouns the site knows about:"]
|
[:p "here are some pronouns the site knows about:"]
|
||||||
@ -165,7 +165,7 @@
|
|||||||
[:meta {:name "viewport" :content "width=device-width"}]
|
[:meta {:name "viewport" :content "width=device-width"}]
|
||||||
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
||||||
[:body
|
[:body
|
||||||
(title-block title)
|
(header-block title)
|
||||||
[:div {:class "section examples"}
|
[:div {:class "section examples"}
|
||||||
[:p [:h2 (str "We couldn't find those pronouns in our database."
|
[:p [:h2 (str "We couldn't find those pronouns in our database."
|
||||||
"If you think we should have them, please reach out!")]]]
|
"If you think we should have them, please reach out!")]]]
|
||||||
|
10
test/pronouns/pages_test.clj
Normal file
10
test/pronouns/pages_test.clj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
(ns pronouns.pages-test
|
||||||
|
(:require [pronouns.pages :as pages]
|
||||||
|
[midje.sweet :refer :all]))
|
||||||
|
|
||||||
|
(fact "prose-comma-list turns a list of strings into a prose list with commas"
|
||||||
|
(pages/prose-comma-list ["foo"]) => "foo"
|
||||||
|
(pages/prose-comma-list ["foo" "bar"]) => "foo and bar"
|
||||||
|
(pages/prose-comma-list ["foo" "bar" "baz"]) => "foo, bar, and baz"
|
||||||
|
(pages/prose-comma-list ["foo" "bar" "baz" "bobble"]) => "foo, bar, baz, and bobble"
|
||||||
|
(pages/prose-comma-list []) => "")
|
Loading…
Reference in New Issue
Block a user