From 665b2db7d82a619d0c301a38c5fa5fd04990d857 Mon Sep 17 00:00:00 2001 From: Mike Adeleke Date: Mon, 10 Feb 2014 11:33:38 -0600 Subject: [PATCH 1/2] all tests are passing --- zoo.rb | 17 +++++++++++++++++ zoo_spec.rb | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/zoo.rb b/zoo.rb index d4d906c..70f0713 100644 --- a/zoo.rb +++ b/zoo.rb @@ -38,6 +38,9 @@ def full? @meals > 30 end + def feed(food) + end + end class Lion @@ -65,6 +68,7 @@ class Tacos < Food; end class Wildebeests < Food; end class Zeebras < Food; end class Bamboo < Food; end +class Bacon < Food; end class Zookeeper def feed(args={}) @@ -75,3 +79,16 @@ def feed(args={}) end +class Human + include Animal + + def acceptable_food + [Bacon.new, Tacos.new] + end +end + +class FoodBarge + def food_for(panda) + end + +end \ No newline at end of file diff --git a/zoo_spec.rb b/zoo_spec.rb index 64203cc..04fa923 100644 --- a/zoo_spec.rb +++ b/zoo_spec.rb @@ -80,3 +80,40 @@ class Salad < Food; end Zookeeper.new.feed(food: :zeebras, to: lion) end end + + +describe Human do + it "should like bacon" do + Human.new.likes?(Bacon.new).should eq(true) + end + + it "should like tacos" do + Human.new.likes?(Tacos.new).should eq(true) + end + + it "should not like bamboo" do + Human.new.likes?(Bamboo.new).should eq(false) + end + +end + +describe FoodBarge do + it "should have the panda eat the food" do + foodbarge = FoodBarge.new + panda = Panda.new + food = foodbarge.food_for(panda) + panda.feed(food) + end + +end + + + + + + + + + + + From a70e883a3677a5d744234147a50290037d693748 Mon Sep 17 00:00:00 2001 From: Mike Adeleke Date: Tue, 11 Feb 2014 21:56:16 -0600 Subject: [PATCH 2/2] updated tests with no empty methods --- zoo.rb | 2 ++ zoo_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/zoo.rb b/zoo.rb index 70f0713..9b6c150 100644 --- a/zoo.rb +++ b/zoo.rb @@ -39,6 +39,7 @@ def full? end def feed(food) + true end end @@ -89,6 +90,7 @@ def acceptable_food class FoodBarge def food_for(panda) + true end end \ No newline at end of file diff --git a/zoo_spec.rb b/zoo_spec.rb index 04fa923..5f533e9 100644 --- a/zoo_spec.rb +++ b/zoo_spec.rb @@ -101,8 +101,8 @@ class Salad < Food; end it "should have the panda eat the food" do foodbarge = FoodBarge.new panda = Panda.new - food = foodbarge.food_for(panda) - panda.feed(food) + food = foodbarge.food_for(panda).should eq(true) + panda.feed(food).should eq(true) end end