def test_can_fill_its_hashes_from_example(self): hashes = Hashes(keys=('key', '<key>'), values=[('<value>', 'value')]) outline_step = Step('Given', 'a step', hashes=hashes) filled_step = outline_step.fill_from_example({'<key>': 'a key', '<value>': 'a value'}) filled_step.hashes |should| each_be_equal_to([ {'a key': 'value', 'key': 'a value'}, ])
def test_can_fill_its_multiline_from_example(self): outline_step = Step('Given', 'a step', multilines=['with <placeholder>\n']) filled_step = outline_step.fill_from_example( {'<placeholder>': 'replacement'}) filled_step.multiline | should | be_equal_to('with replacement\n')
def test_passes_capture_groups_to_definition(self): @step('this is (.*)') def this_is_captured(step, capture): my_world.capture = capture step_ = Step('Given', 'this is captured') my_world = World() my_world.capture = None step_.run() my_world.capture |should| be_equal_to('captured')
def test_can_run_if_defined(self): @step('there is a step') def there_is_a_step(step): world.run_count += 1 step_ = Step('Given', 'there is a step') world = World() world.run_count = 0 step_.run() world.run_count |should| be(1)
def test_passes_capture_groups_to_definition(self): @step('this is (.*)') def this_is_captured(step, capture): my_world.capture = capture step_ = Step('Given', 'this is captured') my_world = World() my_world.capture = None step_.run() my_world.capture | should | be_equal_to('captured')
def test_can_run_if_defined(self): @step('there is a step') def there_is_a_step(step): world.run_count += 1 step_ = Step('Given', 'there is a step') world = World() world.run_count = 0 step_.run() world.run_count | should | be(1)
def test_can_fill_its_hashes_from_example(self): hashes = Hashes(keys=('key', '<key>'), values=[('<value>', 'value')]) outline_step = Step('Given', 'a step', hashes=hashes) filled_step = outline_step.fill_from_example({ '<key>': 'a key', '<value>': 'a value' }) filled_step.hashes | should | each_be_equal_to([ { 'a key': 'value', 'key': 'a value' }, ])
def test_is_looked_up_case_insensitive(self): @step('miXed Case definItion') def mixed_case_definition(step): pass step_ = Step('Given', 'a MixeD case Definition') step_ | should | be_defined
def test_knows_if_it_is_defined(self): @step('there is a step') def there_is_a_step(step): pass step_ = Step('Given', 'there is a step') step_.is_defined | should | be(True)
def test_can_fill_its_multiline_from_example(self): outline_step = Step('Given', 'a step', multilines=['with <placeholder>\n']) filled_step = outline_step.fill_from_example({'<placeholder>': 'replacement'}) filled_step.multiline |should| be_equal_to('with replacement\n')
def test_can_fill_itself_from_example(self): outline_step = Step('Given', 'an <outlined> step') filled_step = outline_step.fill_from_example({'<outlined>': 'filled'}) filled_step.text |should| be_equal_to('an filled step')
def test_can_fill_itself_from_example(self): outline_step = Step('Given', 'an <outlined> step') filled_step = outline_step.fill_from_example({'<outlined>': 'filled'}) filled_step.text | should | be_equal_to('an filled step')
def test_knows_if_it_is_undefined(self): step = Step('Given', 'there is a step') step.is_undefined | should | be(True)
def test_can_be_created(self): step = Step('Given', 'there is a step')