[rspec-users] GivenScenario in cucumber

Bart Zonneveld zuperinfinite at gmail.com
Thu Jan 15 16:38:55 EST 2009

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


More information about the rspec-users mailing list