On Jan 24, 2008 3:47 AM, Kamal Fariz <[EMAIL PROTECTED]> wrote:
> > With 1.1.1 you can do this:
> >
> > Given "$n_users in the system" do |num_users|
> >  case num_users
> >  when "a user"
> >    # one user case
> >  when /(\d*) users/
> >    # multi user case using $1
> >  end
> > end
> >
> > With 1.1.2 you can do this:
> >
> > Given /(a|\d*) users? in the system/ do |num_users|
> >  num_users = (num_users == 'a') ? 1 : num_users.to_i
> >  (1..num_users).each do
> >   # ...
> >  end
> > end
>
> Didn't know you could do that! Thanks. So, the step will yield all the
> matches in the same order regexp will populate the matches array?

Yep.

Cheers,
David

>
>
> Regards,
> kamal
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to