[rspec-users] Sharing common Cuke steps

Matt Wynne matt at mattwynne.net
Fri May 8 08:55:32 EDT 2009

On 8 May 2009, at 09:12, aslak hellesoy wrote:

> On 8 May 2009, at 05:55, Mike Doel wrote:
> Cucumber is awesome and destined to rule the world.  As that starts  
> to happen, has there been any thought of a mechanism for the  
> community to build a library of common, generally useful steps that  
> can be used across projects?  I've got stuff that I use for myself at:
> http://github.com/mdoel/cukesteps/tree/master
> This is stuff that I wish were in the default webrat_steps.rb file  
> that you get at the start.  Would it be better to fork Cucumber and  
> add them there and send a pull request to Aslak?
> It seems to me that there's an opportunity for packaging together  
> and sharing steps, but am curious of folks thoughts on the best way  
> to go about this.
> Mike
> Great stuff, Mike.
> I had a similar thought a while back, but it never really took off:
> http://www.mail-archive.com/rspec-users@rubyforge.org/msg07936.html
> I feel like this might be better suited to being a separate project,  
> as you'll eventually have steps that are only relevant in certain  
> contexts (we have quite a few that depend on factory_girl, for  
> example), and it's likely to change at a different rate to the core  
> cucumber code.
> It's almost like you want a kind of plug-in mechanism for sharing re- 
> usable step libraries.
> I agree with Matt - this sounds great. Could you add a link to the  
> related tools page in the wiki?
> I think we already have a plugin mechanism for this. It's called  
> RubyGems ;-)
> Aslak

So are you saying we'd put the steps in a gem, then include them using  

So I can do this in my env file:

	gem 'cucumber-steps'

	require 'cucumber/steps/webrat'
	require 'cucumber/steps/factory_girl'

or in another project that uses the command line:

	gem 'cucumber-steps'

	require 'cucumber/steps/console'

Is that the kind of thing you mean? I think it would be good to allow  
for steps that cater to different use cases to all be in the same  
library but allow you to pick and chose the ones that are relevant to  
your project.

Matt Wynne

More information about the rspec-users mailing list