Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions zoo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def full?
@meals > 30
end

def feed(food)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this method empty?

end

end

class Lion
Expand Down Expand Up @@ -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={})
Expand All @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also an empty method

end

end
37 changes: 37 additions & 0 deletions zoo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have any specifications -- just some code that doesn't explode

end

end