def test_cause_damage(self): """ Test that triggered poison will damage character """ character = (CharacterBuilder() .with_hit_points(10) .build()) poison = Poison(duration = 1, frequency = 1, tick = 0, damage = 5, target = character) poison.trigger() assert_that(character.hit_points, is_(equal_to(5)))
def test_event_is_raised_on_trigger(self): """ Test that event is raised when poison is triggered """ model = mock() character = (CharacterBuilder() .with_hit_points(10) .with_model(model) .build()) poison = Poison(duration = 1, frequency = 1, tick = 0, damage = 5, target = character) poison.trigger() verify(model).raise_event(any())
def test_character_can_die(self): """ Test that character with less than 1 hit points is removed from play """ character = (CharacterBuilder() .with_hit_points(5) .build()) level = (LevelBuilder() .with_character(character) .build()) poison = Poison(duration = 0, frequency = 0, tick = 0, damage = 10, target = character) poison.trigger() assert_that(character, is_not_at(level))