Forum: RSpec GivenScenario in cucumber

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bart Z. (Guest)
on 2009-01-15 23:47
(Received via mailing list)
Hey all,

I've read
http://rspec.lighthouseapp.com/projects/16211-cucu...
, 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! :)

thanks,
bartz
Joseph W. (Guest)
on 2009-01-16 01:33
(Received via mailing list)
Bart Z. wrote:
>
>
> 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-cucu...

WDYT?

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

--
Joseph W.
http://blog.josephwilk.net
Bart Z. (Guest)
on 2009-01-16 15:47
(Received via mailing list)
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! :)
>
> We have been looking at adding a 'Background' section to cucumber.
>
> 
http://rspec.lighthouseapp.com/projects/16211-cucu...
>
> WDYT?

Excellent! An extremely "fluent" solution!

> This should be coming to a cucumber near you soon :)

Can't wait :)

gr,
bartz
This topic is locked and can not be replied to.