[rspec-users] Running all stories in a directory

Jim Morris ml at e4net.com
Thu Jul 24 07:13:46 EDT 2008

I have a bunch on non-rails stories, and I want to run them all with either a rake task or a script.

I tried the all.rb approach from rails, but is doesn't seem to work.

I do this basically...

  dir = File.dirname(__FILE__)
   tests= []
   %w(story1 story2 story3).each do |f|
     tests << File.join(dir, f) + ".rb"

   puts "Testing: #{tests.join(',')}"

   tests.each do |file|
     require file

Should this work?

Some of the stories run OK, but some seem to not be setup properly, they run fine if run 
individually from the command line as...

 > ruby story2.rb

Jim Morris, http://blog.wolfman.com

More information about the rspec-users mailing list