Running single spec files -- how?


#1

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?


#2

court3nay wrote:

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


#3

On May 11, 2009, at 7:10 PM, 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

I would assume that would work if you are requiring test-unit interop
mode. I believe in previous versions of rspec it was automatically
included if the constants Test && Test::Unit were present (which AR
automatically adds once AR is required).

Is that correct? Am I missing something?
I’ve always kept around this alias:

alias ss=’./script/spec -O spec/spec.opts’

So I can do:

ss spec/unit/models/event_*

Scott