[rspec-users] ruby file.spec?

Zach Dennis zach.dennis at gmail.com
Thu Nov 12 20:36:53 EST 2009

On Thu, Nov 12, 2009 at 7:34 PM, rogerdpack <rogerpack2005 at gmail.com> wrote:
> perhaps this has been discussed before and you can point me to the
> right thread, but is it possible to run specs from the command line
> using just ruby?
> ruby arguments_spec.rb
> and it "just run" (like test/unit seems to)?
> I can't think of a great reason why this would be useful, other than
> not having to remember which command is which to run files--you only
> have to type "ruby" (and IDE's that aren't spec aware would be easier
> to run with).

You want to use "spec" to run files directly. If you have your heart
set on running files from "ruby" then you'll need to load
"spec/autorun" to actually execute the specs. Note using the following
will not work on ruby 1.8.x (see thread
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/334942 )
but it should work on 1.9.x.
    ruby -rubygems -rspec -rspec/autorun file_spec.rb

Zach Dennis
http://www.continuousthinking.com (personal)
http://www.mutuallyhuman.com (hire me)
http://ideafoundry.info/behavior-driven-development (first rate BDD training)
@zachdennis (twitter)

More information about the rspec-users mailing list