Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to 'rake spec' one directory, e.g. models?

I can rake spec and all specs run.

However trying to run specs for one directory, as in

rake spec/models/ or rake spec/models/*.rb 

does not provide any output or errors.

One option is that I can do

rspec spec/models/*.rb

or

rspec spec/models/

but I was wondering if I could stay within Rake.

like image 566
Michael Durrant Avatar asked Sep 01 '13 03:09

Michael Durrant


2 Answers

Try rake spec:models instead of rake spec/models. Run rake -T | grep spec to see all the available rake spec tasks.

UPDATE: Running your specs through rake spec may be slower than running them through rspec spec, said by the rspec-rails guys. Read de installation section of rspec-rails.

like image 167
Nicolas Garnil Avatar answered Oct 03 '22 11:10

Nicolas Garnil


Use SPEC env. variable: rake spec SPEC=spec/models

like image 42
brauliobo Avatar answered Oct 03 '22 10:10

brauliobo