Commit 30e2008a by Gabriel Falcão

Merge pull request #178 from rbu/make-undefined-steps-fail

Use assert_raises instead of incorrect try / assert / except
parents 293dd2cc e1ef17db
...@@ -440,24 +440,14 @@ def test_failing_behave_as_step_fails(): ...@@ -440,24 +440,14 @@ def test_failing_behave_as_step_fails():
def test_undefined_behave_as_step_doesnt_pass(): def test_undefined_behave_as_step_doesnt_pass():
'When a step definition calls an undefined step definition with behave_as, that step should not be marked as success.' 'When a step definition calls an undefined step definition with behave_as, that step should not be marked as success.'
runnable_step = Step.from_string('Given I have a step which calls the "undefined step" step with behave_as') runnable_step = Step.from_string('Given I have a step which calls the "undefined step" step with behave_as')
try: assert_raises(AssertionError, runnable_step.run, True)
runnable_step.run(True)
assert False, "Undefined step should raise exception"
except:
pass
assert_false(runnable_step.passed) assert_false(runnable_step.passed)
@with_setup(step_runner_environ) @with_setup(step_runner_environ)
def test_undefined_behave_as_step_fails(): def test_undefined_behave_as_step_fails():
'When a step definition calls an undefined step definition with behave_as, that step should be marked a failure.' 'When a step definition calls an undefined step definition with behave_as, that step should be marked a failure.'
runnable_step = Step.from_string('Given I have a step which calls the "undefined step" step with behave_as') runnable_step = Step.from_string('Given I have a step which calls the "undefined step" step with behave_as')
try: assert_raises(AssertionError, runnable_step.run, True)
runnable_step.run(True)
assert False, "Undefined step should raise exception"
except Exception, e:
pass
assert runnable_step.failed assert runnable_step.failed
@with_setup(step_runner_environ) @with_setup(step_runner_environ)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment