[rspec-users] Running single spec files -- how?

Ben Mabey ben at benmabey.com
Mon May 11 19:16:21 EDT 2009


court3nay wrote:
> Before upgrading from 1.1.11 to 1.2.4 I used to be able to do this:
>
>   ruby spec/models/user_spec.rb
>
> Now it looks like you have to do
>
>   script/spec spec/models/user_spec.rb
>
> Or something like this, which is actually kinda cool:
>
>   script/spec spec/*/user*
>
> Is that correct? Am I missing something?
>   

There was a change that broke this behaviour, but it was documented in 
the History and how to get back the old behaviour:

=== Version 1.2.0 / 2009-03-15

* warnings:

  * If you use the ruby command to run specs instead of the spec 
command, you'll
    need to require 'spec/autorun' or they won't run. This won't affect 
you if
    you use the spec command or the Spec::Rake::SpecTask that ships with 
RSpec.



So... just add a require 'spec/autorun' in your spec_helper.rb and you 
should be good to go.

HTH,

Ben


More information about the rspec-users mailing list