Commit aa05eaf9 by Gabriel Falcao

fixing a bug with using email addresses in steps

parent 78875556
...@@ -708,9 +708,11 @@ class Scenario(object): ...@@ -708,9 +708,11 @@ class Scenario(object):
def try_finding_with(regex): def try_finding_with(regex):
found = regex.search(original_string) found = regex.search(original_string)
if found: if found:
tag_lines = found.group().splitlines() tag_lines = found.group().splitlines()
return list(chain(*map(self._extract_tag, tag_lines))) tags = list(chain(*map(self._extract_tag, tag_lines)))
return tags
for regex in regexes: for regex in regexes:
found = try_finding_with(regex) found = try_finding_with(regex)
...@@ -720,8 +722,9 @@ class Scenario(object): ...@@ -720,8 +722,9 @@ class Scenario(object):
return [] return []
def _extract_tag(self, item): def _extract_tag(self, item):
regex = re.compile(r'[@](\S+)') regex = re.compile(r'(?:(?:^|\s+)[@]([^@\s]+))')
return regex.findall(item) found = regex.findall(item)
return found
def _resolve_steps(self, steps, outlines, with_file, original_string): def _resolve_steps(self, steps, outlines, with_file, original_string):
for outline in outlines: for outline in outlines:
......
...@@ -153,7 +153,7 @@ Feature: Yay tags ...@@ -153,7 +153,7 @@ Feature: Yay tags
@many @other @many @other
@basic @basic
@tags @here @:) @tags @here @:)
Scenario: Holy tag, Batman Scenario: Double Yay
Given this scenario has tags Given this scenario has tags
Then it can be inspected from within the object Then it can be inspected from within the object
""" """
...@@ -175,7 +175,7 @@ Feature: Yay tags and many scenarios ...@@ -175,7 +175,7 @@ Feature: Yay tags and many scenarios
""" """
FEATURE13 = """ FEATURE13 = '''
Feature: correct matching Feature: correct matching
@runme @runme
Scenario: Holy tag, Batman Scenario: Holy tag, Batman
...@@ -184,17 +184,20 @@ Feature: correct matching ...@@ -184,17 +184,20 @@ Feature: correct matching
Scenario: This has no tags Scenario: This has no tags
Given this scenario has tags Given this scenario has tags
When I fill my email with gabriel@lettuce.it
Then it can be inspected from within the object Then it can be inspected from within the object
@slow @slow
Scenario: this is slow Scenario: this is slow
Given this scenario has tags Given this scenario has tags
When I fill my email with "gabriel@lettuce.it"
Then it can be inspected from within the object Then it can be inspected from within the object
Scenario: Also without tags Scenario: Also without tags
Given this scenario has tags Given this scenario has tags
When I fill my email with 'gabriel@lettuce.it'
Then it can be inspected from within the object Then it can be inspected from within the object
""" '''
FEATURE14 = """ FEATURE14 = """
Feature: Extra whitespace feature Feature: Extra whitespace feature
......
...@@ -22,7 +22,7 @@ from mox import Mox ...@@ -22,7 +22,7 @@ from mox import Mox
def test_has_version(): def test_has_version():
"A nice python module is supposed to have a version" "A nice python module is supposed to have a version"
assert_equals(lettuce.version, '0.2.0') assert_equals(lettuce.version, '0.2.3')
def test_has_release(): def test_has_release():
......
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