Skip to content

Instantly share code, notes, and snippets.

@russ
Created March 5, 2012 21:21
Show Gist options
  • Save russ/1981185 to your computer and use it in GitHub Desktop.
Save russ/1981185 to your computer and use it in GitHub Desktop.
class Hero
attr_reader :hp
def initialize
@hp = 100
end
def hit!(force)
@hp -= force
end
def heal!(amount)
@hp += amount
end
end
describe Hero do
subject { Hero.new }
it "should lower hp when they're hit" do
subject.hit!(10)
subject.hp.should == 90
end
it "should raise hp when they heal" do
subject.heal!(10)
subject.hp.should == 110
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment