GivenScenario in cucumber

Hey all,

I’ve read
http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/3-%20%20create-givenscenario-dependency-accross-feature-file
, and would like to share another idea about this.

I’m building a blog at the moment, in which users can report a comment
as spam. So, I have a feature which describes a user reporting a
comment as spam. Imagine I’m writing a feature which describes what
happens then, maybe an email gets sent to someone, or whatever.

In order to get to the “Given” point where the comment is actually
marked as spam, I currently only have 1 option.
To repeat (almost) every step I’ve written for the “Report as spam
feature” into a new Given “a comment has been marked as spam”.

This is doable, however, it violates DRY, and it also creates a very
brittle big step. If I ever change my implementation of reporting a
comment as spam, I also have to update this collated Given step.
In this case, I’d really like to use the entire “Report as spam
feature” feature as Given step for my new feature.

I might be totally missing something. If that’s the case, please
enlight me! :slight_smile:

thanks,
bartz

Bart Z. wrote:

I might be totally missing something. If that’s the case, please
enlight me! :slight_smile:

We have been looking at adding a ‘Background’ section to cucumber.

http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/153-add-optional-background-section-to-features#ticket-153-11

WDYT?

This should be coming to a cucumber near you soon :slight_smile:


Joseph W.

On 15 jan 2009, at 23:24, Joseph W. wrote:

or whatever.
In this case, I’d really like to use the entire “Report as spam
feature” feature as Given step for my new feature.

I might be totally missing something. If that’s the case, please
enlight me! :slight_smile:

We have been looking at adding a ‘Background’ section to cucumber.

Lighthouse - Beautifully Simple Issue Tracking

WDYT?

Excellent! An extremely “fluent” solution!

This should be coming to a cucumber near you soon :slight_smile:

Can’t wait :slight_smile:

gr,
bartz