Forum: RSpec cucumber command

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.
F1e1789ff9e7fc3032fa6cf15382a1e8?d=identicon&s=25 Juanma Cervera (jmcervera)
on 2008-12-26 11:08
Hello
I want to use the cucumber command to run only the feature I am working
on now.
But I have a structure of folders like this:

  features/
    administracion/
      alta_centros.feature
      modificacion_centros.feature
      step_definitions/
        steps_for_centros.rb
    ...
    step_definitions/
      general.rb
      webrat_steps.rb
    support/
      env.rb

When I use "rake features" all works, but I am running all the features.
Now I want to run only one of the features.

  cucumber --language es features/administracion/alta_centros.feature

And the feature fails. It seems that it is not reading env.rb and the
other step definition files.
Can I have a folder structure like this?
How I have to use the cucumber command to make this.

Thanks
Juanma
Ff937b6907db49432c980f2b6a5c7e71?d=identicon&s=25 Mischa Fierer (mischa)
on 2008-12-26 11:21
(Received via mailing list)
try:

rake features FEATURE=features/administracion/alta_centros.feature
F1e1789ff9e7fc3032fa6cf15382a1e8?d=identicon&s=25 Juanma Cervera (jmcervera)
on 2008-12-26 11:46
Mischa Fierer wrote:
> try:
>
> rake features FEATURE=features/administracion/alta_centros.feature

It works.
Thank you very much
F68f69615423aa3851bd445409754dbf?d=identicon&s=25 Joseph Wilk (joesniff)
on 2008-12-26 12:27
(Received via mailing list)
Juanma Cervera wrote:
>         steps_for_centros.rb
>   cucumber --language es features/administracion/alta_centros.feature
>
> And the feature fails. It seems that it is not reading env.rb and the
> other step definition files.
>

When running the cucumber command directly it will implicitly require
the sibling and ancestor ruby files  of the feature. So as you suggested
it will not auto load your env.rb or you step_definitions folder.
> Can I have a folder structure like this?
>
You can have whatever folder structure you want. If you look at the
default layout generated by cucumber it uses a similar structure to what
you have now (support / step_definitions).

> How I have to use the cucumber command to make this.
>
If you want to use the tool directly you could do:

cucumber --require features/support/ --require
features/step_definitions/  --language es
features/administracion/alta_centros.feature

HTH
--
Joseph Wilk
http://blog.josephwilk.net
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2008-12-26 14:05
Joseph Wilk wrote:

> If you want to use the tool directly you could do:
>
> cucumber --require features/support/ --require
> features/step_definitions/  --language es
> features/administracion/alta_centros.feature

This style works for me, from the project root directory:

$ cucumber -r features features/administracion/alta_centros.feature

Have not tried this with the language option though.
This topic is locked and can not be replied to.