Search code examples
rspeccapybararspec-rails

How to exclude a folder of specs from running while executing `rspec spec`?


I currently have a folder called QA within the spec folder that contains capybara tests. The QA folder is primarily meant to be run by the QA team. Because of this, I do not want these specs to be run while executing rspec spec. Instead, I only want them to be run while executing rspec spec -t ~all. What would be the best way to accomplish this?


Solution

  • You can specify an exclusion pattern

    rspec --exclude-pattern spec/QA/*.rb
    

    or you could tag all the QA tests with a specific tag (qa perhaps) and then exclude that tag

    rspec -t ~qa