Created
March 5, 2012 21:13
-
-
Save russ/1981140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hero | |
attr_reader :hp | |
def initialize | |
@hp = 100 | |
end | |
def hit!(force) | |
@hp -= force | |
end | |
end | |
describe Hero do | |
subject { Hero.new } | |
it "should lower hp when they're hit" do | |
lambda { | |
subject.hit!(10) | |
}.should change(subject, :hp).by(-10) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment