Skip to content

Commit

Permalink
Adapt BDD according to Tom's remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Jan 28, 2016
1 parent a86f097 commit 99790f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions docs/behavior.rst
Expand Up @@ -184,7 +184,10 @@ Then state {state} should be active
Assert that given state name is active.

Then state {state} should not be active
Assert that given state name is not active
Assert that given state name is not active.

Then the statechart is in a final configuration
Assert that the statechart is in a final configuration.

Then event {event_name} should be fired
Assert that given event name is the latest fired event.
Expand All @@ -194,7 +197,7 @@ Then event {event_name} should be fired with {parameter}={value}
with given *value*, evaluated as Python code.
Additional parameters can be specified using a table.

Then there should be no fired event
Then no event should be fired
Assert that no event was fired by the statechart during the last execution.

Then variable {variable} should be defined
Expand Down
7 changes: 6 additions & 1 deletion sismic/testing/steps.py
Expand Up @@ -132,6 +132,11 @@ def state_is_not_active(context, state):
assert state not in context._interpreter.configuration, 'State {} is active'.format(state)


@then('the statechart is in a final configuration')
def statechart_is_final(context):
assert context._interpreter.final, 'The statechart is not in a final configuration: {}'.format(context._interpreter.configuration)


@then('event {event_name} should be fired')
@then('event {event_name} should be fired with {parameter}={value}')
def event_is_received(context, event_name, parameter=None, value=None):
Expand All @@ -156,7 +161,7 @@ def event_is_received(context, event_name, parameter=None, value=None):
assert False, 'No matching event fired for {} with {} in {}'.format(event_name, parameters, context._events)


@then('there should be no fired event')
@then('no event should be fired')
def no_event_received(context):
assert len(context._events) == 0, 'Sent events: {}'.format(context._events)

Expand Down

0 comments on commit 99790f1

Please sign in to comment.