Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework 1 #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
10 changes: 9 additions & 1 deletion zoo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ def full?
end
end

class Zookeeper
class Human
include Animal

def acceptable_food
[:bacon, :tacos]
end
end

class Zookeeper < Human
def feed(args={})
food = args.fetch(:food)
panda = args.fetch(:to)
Expand Down
15 changes: 15 additions & 0 deletions zoo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@
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
end


describe Zookeeper do
it "should be able to feed bamboo to the pandas" do
panda = Panda.new
Expand Down