spec/bacon_helper.rb in caricature-0.3.0 vs spec/bacon_helper.rb in caricature-0.3.1

- old
+ new

@@ -10,16 +10,45 @@ load_assembly 'ClrModels' class Soldier + def initialize + @life = 10 + end + def name "Tommy Boy" end def to_s "I'm a soldier" end + + def attack(target, weapon) + weapon.attack(target) + end + + def is_killed_by?(weapon) + weapon.damage > 3 + end + + def survive_attack_with(weapon) + @life - weapon.damage + end + +end + +class Dagger + + def damage + 2 + end + + def attack(target) + target.survive_attack_with self + end + end module Caricature