Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion zoo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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={})
food = args.fetch(:food)
Expand All @@ -74,4 +74,17 @@ def feed(args={})
end

end
##
# Added Human Class
class Human
include Animal
def acceptable_food
[Bacon.new, Tacos.new]
end

def full?
@meals > 3
end

end

12 changes: 12 additions & 0 deletions zoo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,15 @@ class Salad < Food; end
Zookeeper.new.feed(food: :zeebras, to: lion)
end
end
##
# Added Human spec
describe Human do
it "should like bacon and tacos" do
Human.new.likes?(Bacon.new).should eq(true)
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