diff --git a/Gemfile.lock b/Gemfile.lock index 277fb87..8b2355e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,6 +14,7 @@ GEM PLATFORMS ruby + x86-mingw32 DEPENDENCIES rake diff --git a/zoo.rb b/zoo.rb index 8f5eea5..866f188 100644 --- a/zoo.rb +++ b/zoo.rb @@ -52,6 +52,20 @@ def full? end end + +class Human + include Animal + + def acceptable_food + [:bacon, :tacos] + end + + def full? + @meals > 2 + end +end + + class Zookeeper def feed(args={}) food = args.fetch(:food) diff --git a/zoo_spec.rb b/zoo_spec.rb index 4943c90..e06e468 100644 --- a/zoo_spec.rb +++ b/zoo_spec.rb @@ -61,6 +61,32 @@ lion.should be_full end end +describe Human do + it "should like bacon" do + Human.new.likes?(:bacon).should eq(true) + end + + it "should like tacos" do + Human.new.likes?(:tacos).should eq(true) + end + + it "should not like bamboo" do + Human.new.likes?(:bamboo).should eq(false) + end + + it "should take 3 meals to be full" do + human = Human.new + human.eat(:bacon) + human.should_not be_full + end + it "should take 3 meals to be full" do + human = Human.new + 3.times do + human.eat(:tacos) + end + human.should be_full + end +end describe Zookeeper do it "should be able to feed bamboo to the pandas" do @@ -75,3 +101,4 @@ Zookeeper.new.feed(food: :zeebras, to: lion) end end +