On 8 Nov 2008, at 11:22, aslak hellesoy wrote:
On Sat, Nov 8, 2008 at 11:01 AM, Matt Wynne <[EMAIL PROTECTED]> wrote:
The common_webrat.rb steps file that comes with cucumber when you add it to
rails really inspired our team.

We've extended it a fair bit to do various other things to check the content
of a page such as [1] which enable us to write steps like this:

I feel like I want to share this stuff and collaborate on it in a broader group outside our team but I'm not sure what would be the appropriate route. Obviously this stuff is pretty easy to re-use - you just have to require a ruby file that defines the steps so it's not like cucumber needs a plug-in
manager exactly...

What do people think? Is this stuff so trivially easy to other people that they prefer just to write it from scratch? Or are you also writing step matchers that you think other people could be using? How do you think we
could best share them and collaborate on them?


I think some basic steps for output validation is good. I like the
essence in yours. Please add it in your fork.

Glad you like the idea :)

Okay, tentatively, I've factored over the obvious steps I can see in our project that could easily be reused:

http://github.com/songkick/cucumber/commit/b80da2b024ac17dcf1ebe79ebd7445c45bf984a6

This would mean that the sample 'common_webrat.rb' step that's created by the rails generator could just consist of the following line:

    require 'cucumber/steps_library/webrat'

In fact, this could just go into env.rb - that's what I've done in our project now the code is factored away in cucumber.

Now this is just a spike, and I have my concerns / thoughts:
* If other people are going to be depending on these steps, they really need automated tests of some sort that ship alongside them.
  * I've introduced three new methods in the global namespace - yuck!
    * How should these best be factored away somewhere non-polluting?
    * Should within_list() go into webrat maybe?
* Is 'cucumber/steps_library' the right name / place to put these? Could be 'step_matchers_library' instead maybe? * If we're going to start squirrelling step matchers away in a library / libraries, do we need a way to ask the StepMother to list them (kinda like rake routes)?

Okay that's it for now. All feedback extremely welcome :)

cheers,
Matt
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to