[rspec-users] Executing multiple rspec scripts

Ben Mabey ben at benmabey.com
Thu Jul 10 23:17:19 EDT 2008

Robert Stagner wrote:
> I'm new to RSpec.  I've just installed the gem and begun experimenting 
> with developing several scripts. From what I've seen thus far, it 
> looks like it will aid our QA team in testing many web applications.  
> Is there a way to execute multiple rspec test scripts from one central 
> file?
> -- 
> Regards,
> Robert

Welcome to rspec!  There are a number of ways you can do this.  You can
do it with the command line:
spec spec/*_spec.rb

The way it is generally done is by using a rake task however...
Are you using rails?  If so.. have you run "./script/generate rspec"?
That will install a spec task for you so you just have to type "rake
spec" to run all of your specs.

If you are in a normal ruby app then you can create your own spec task
by putting this in your Rakefile or tasks dir:

  require 'rubygems'
  require 'spec'
  require 'spec/rake/spectask'

desc "Run the specs under spec/models"
Spec::Rake::SpecTask.new do |t|
  t.spec_files = FileList['spec/*_spec.rb']

If you provide more information on what your setup is we could help more.


More information about the rspec-users mailing list