[rspec-users] GivenScenario in cucumber

Joseph Wilk joe at josephwilk.net
Thu Jan 15 17:24:28 EST 2009


Bart Zonneveld wrote:
> 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! :)

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 :)

--
Joseph Wilk
http://blog.josephwilk.net
>
> thanks,
> bartz
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



More information about the rspec-users mailing list