[rspec-users] Running a specific row in cucumber example table

Matt Wynne matt at mattwynne.net
Fri Oct 2 12:21:19 EDT 2009

On 2 Oct 2009, at 17:16, Sam Treweek wrote:

> I want to be able to execute only 1 row in an Scenario/Outline Example
> table. Is there a method already created for me to access. I have
> certain validation rules for only running 1 row of data coming from an
> external request to execute cuke.
> So having something in a step_definition file like:
> test.rb
> If $something
>   table.row.skip
> end
> Before do
>  pending
> end

I have no idea if this will work, but you could try to sense for the  
table row you want to skip in a Before block, then call skip_invoke!  
on it:

Before(scenario_or_example_row) do
   if the_one_to_skip?(scenario_or_example_row)

That might work for you, but you should be aware that #skip_invoke! is  
not part of the public API right now and might be changed without  

Obviously you'll have to write #the_one_to_skip? method yourself...

It would probably be better to be able to tag the example table row,  
and just filter it out before the feature run. We can't do that right  
now can we?

> etc...
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


+447974 430184

More information about the rspec-users mailing list