Search code examples
rubytestingrspeccapybararspec-rails

Capybara + RSpec, spec/features dir being ignored by the rspec . command?


I'm using the new Capybara DSL with rspec following the short guideline located here And the tests added to the spec/features directory run well alone, ie.

rails_project$ rspec spec/features/my_first_feature.rb

However the spec/features directory is totally ignored when I try to run the tests for the entire spec/ directory like this:

rails_project$ rspec .

There is no mention in the guide about how to include this directory (or other directory) to accomplish this inclusion that I desire. I really need this for continuous integration of my project.

Can anybody please tell me how to do it?

Thanks!


Solution

  • You need to make sure all of your specs end in_spec.rb.

    Change the filename to spec/features/my_first_feature_spec.rb

    This is how I do it:

    rspec spec
    

    You may also want to use guard-rspec, which gives you better control.