Added one test to the polymorph suite (test name usage)

* added one tests that verifies that the diet function also
  accesses the name value of the map (before it was possible
  to just return "Bambi eats veggies." for the herbivore diet
* since this is not the main purpose of these specs added just
  this one and not extra specs for default/carnivore as I didn't
  want to bloat it, but could add those as well if desired
This commit is contained in:
Tobias Pfeiffer 2013-10-26 19:00:21 +02:00 committed by Colin Jones
parent 40505491f8
commit 92c7f8b2f0

View File

@ -30,6 +30,10 @@
(= "Simba eats animals." (= "Simba eats animals."
(diet {:species "lion" :name "Simba" :age 1 :eater :carnivore})) (diet {:species "lion" :name "Simba" :age 1 :eater :carnivore}))
"Animals have different names"
(= "Thumper eats veggies."
(diet {:species "rabbit" :name "Thumper" :age 1 :eater :herbivore}))
"You may use a default method when no others match" "You may use a default method when no others match"
(= "I don't know what Rich Hickey eats." (= "I don't know what Rich Hickey eats."
(diet {:name "Rich Hickey"}))) (diet {:name "Rich Hickey"})))