Skip to content

Instantly share code, notes, and snippets.

@russ
Created March 5, 2012 21:13
Show Gist options
  • Save russ/1981140 to your computer and use it in GitHub Desktop.
Save russ/1981140 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
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