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
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GEM

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
rake
Expand Down
14 changes: 14 additions & 0 deletions zoo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 27 additions & 0 deletions zoo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -75,3 +101,4 @@
Zookeeper.new.feed(food: :zeebras, to: lion)
end
end