[rspec-users] Running all stories in a directory

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


Jim Morris wrote:
> 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"
>   end
> 
>   puts "Testing: #{tests.join(',')}"
> 
>   tests.each do |file|
>     require file
>   end
> 
> 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
> 
> 

This does work BTW...

replace

   require file

with

   system('ruby', 'file')

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


More information about the rspec-users mailing list