#172 open
Kero

Warn or fail on re-specified When/Then clause

Reported by Kero | December 8th, 2007 @ 06:14 PM

When I specify a When- or Then-clause (i.e. provide a block again) with the same name as a previous one, it should raise an error or at least warn me about the duplicate.

An attempt at a test-file is attached.

I also added a test for the case when a Then-clause has the same name as a When-clause and both provide a block. Maybe this should be a warning and not an error.

Comments and changes to this ticket

  • David Chelimsky

    David Chelimsky December 8th, 2007 @ 08:06 PM

    • → Assigned user changed from “” to “Dan North”
    • → State changed from “new” to “open”

    Actually, the whens and thens are stored separately so that they can use the same step names but mean different things in the different contexts.

    Dan - I'm going to throw this back to you again. Do you think we should be able to use the same step with different implementations across step types?

  • Dan North

    Dan North December 9th, 2007 @ 11:07 PM

    (Hoping that replying to a lighthouse email adds a new comment)

    We're at slightly cross purposes here. You are correct when you say events

    and outcomes ("whens" and "thens") are stored separately, so that "When I

    eat cheese" and "Then I eat cheese" can be implemented differently. I'm ok

    with this, and in fact I think it's quite useful.

    The thing I want to avoid is having "When I eat cheese" mean different

    things in different scenarios - by allowing multiple instances of "When I

    eat cheese" to have blocks. As I said, this is almost always an accident and

    should cause a failure rather than replacing the previous block associated

    with the step.

    If not, the order you run scenarios becomes significant. Imagine a third

    scenario with "When I eat cheese" with no block. Its author is assuming a

    (specific) existing implementation of the step, and is almost certainly

    unaware there is more than one. This is a Bad Thing.

    So in summary:

    • using the same description for different types of step (say givens and

    outcomes) is fine - and each requires an implementation.

    • multiple implementations of the same type of step with the same

    description is bad.

    Hope that clarifies things. And that lighthouse works how I expect :)

    On Dec 8, 2007 7:06 PM, Lighthouse wrote:

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Behaviour Driven Development for Ruby.

Shared Ticket Bins

People watching this ticket

Attachments