Skip to content

Instantly share code, notes, and snippets.

@ramon-src
Created December 19, 2017 16:30
Show Gist options
  • Save ramon-src/2c5b7713e847b9915c0c0a919b6b2d51 to your computer and use it in GitHub Desktop.
Save ramon-src/2c5b7713e847b9915c0c0a919b6b2d51 to your computer and use it in GitHub Desktop.
BDD example with RBehave
@given('the ninja has a {achievement_level}')
def step_the_ninja_has_a(context, achievement_level):
context.ninja_fight = NinjaFight(achievement_level)
@when('attacked by a {opponent_role}')
def step_attacked_by_a(context, opponent_role):
context.ninja_fight.opponent = opponent_role
@when('attacked by {opponent}')
def step_attacked_by(context, opponent):
context.ninja_fight.opponent = opponent
@then('the ninja should {reaction}')
def step_the_ninja_should(context, reaction):
assert_that(reaction, equal_to(context.ninja_fight.decision()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment