Search code examples
ruby-on-railsrubycucumber

How to generate cucumber-rails for a different folder


I'm trying to create a test folder for my rails project using cucumber-rails generator (the gem is here: https://github.com/cucumber/cucumber-rails ).

The problem is that when I run "rails generate cucumber:install" it creates a folder in my project named "features" with the cucumber files inside that folder, which is - in my perspective - not very organized.

I would like all the cucumber files to be inside a folder named "test". Is there a way that allows me to do that? I tried to run the generator inside the "test" folder but it didn't seem to work.

Anyone knows how to do this? Thanks a lot!


Solution

  • There are essentially 3 test libraries in Ruby and corresponding common assumptions:

    • test is expected to contain Test::Unit or MiniTest tests
    • spec is expected to contain RSpec tests
    • features is expected to contain cucumber tests

    You should follow these assumptions or you may end up having several troubles in the long run.

    In any case, to answer your question, what you want to do is not possible. The features folder is hard-code in the generator and in the cucumber task file. Therefore, unless you want to introduce several hacks and workaround, you'll have to follow the conventions.