views:

17

answers:

1

I know

rake spec:models

to spec all models.

Is there a way to spec only one model, or only a given collection of models? Something like this would be desirable:

rake spec:model user

or with a collection of models

rake spec:model user role order

BTW: Brian Hogan wrote created something similar (see here) but maybe there is something built-in in rspec2

A: 

use the rspec command line ( with Rspec 2)

rspec spec/models/user_spec.rb

or if you want several

rspec spec/models/user_spec.rb spec/models/role_spec.rb

If you want a task for that create. it.

shingara
hmm. $ rake spec spec/models/user_spec.rb still executes all specs
agreif
You don't use the rake command. It's the spec command. So without rake in your command line
shingara
spec: command not found. But it works fine with /Users/agreif/usr_local/rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec rspec "./spec/models/person_spec.rb"
agreif
Yes spec is to rspec 1 it's rspec on Rspec 2
shingara