gabrielfalcao/lettuce — Issue #228: If one step regex is a substring of another, either might be run
Author: sixohsix
Created: 2012-02-16 18:06:15+00:00
State: open

If I have two steps where one is a substring of the other, eg:

```python
@step("I log in")
def login_one(step):
pass

@step("I log in on the checkout page")
def login_two(step):
pass
```

Then if I create a test using the latter one, either of these functions might be run depending on the capricious order of the STEP_REGISTRY dict.

In core.py, line 305 in Step._get_match, when iterating STEP_REGISTRY.items, sort by string length longest first to avoid this bug.

I'll try and submit a patch later if I can.