Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rspec run all tests except a specific folder

Tags:

ruby

rspec

The project I'm working on has a fairly large test suite. I am currently writing test that passes when I run it alone but when I run the entire test suite $rspec I get some really funky behavior that causes the test to fail.

Right now the test is nested like this:

spec/folder1/folder2/folder3/test.rb 

Each of these commands run the test fine and everything passes:

$rspec spec/folder1/folder2/folder3 $rspec spec/folder1/folder2 $rspec spec/folder1/ 

There are about 10 other folders at the same level as folder1 that I would like to individually not run with the rest of the suite in order to determine which folder contains tests that are breaking the test I am working on.

Is this possible?

like image 313
Deekor Avatar asked Sep 30 '15 15:09

Deekor


1 Answers

Use an --exclude-pattern, they're quite convenient:

https://www.relishapp.com/rspec/rspec-core/v/3-3/docs/configuration/exclude-pattern

One of the nice things about them:

The --exclude-pattern flag accepts shell style glob unions

So you could do something like rspec --exclude-pattern "spec/{foldername1,foldername2}/**/*_spec.rb"

like image 169
photoionized Avatar answered Sep 25 '22 13:09

photoionized