[rspec-users] autospec: non-standard filenames & redirecting output

DeNigris Sean sean at clipperadams.com
Thu Jan 14 23:10:30 EST 2010


Rspec gurus,

I have 2 questions about autospec.  I've played around quite a bit, but can't figure it out...

1.  I got autospec to work with my directory structure ("examples/*_example.rb"), but it only works if I have an empty spec/ directory.  Otherwise it reverts to running tests instead of examples...
Current ./.autotest:
Autotest.add_discovery do
  "rspec" if File.directory?('examples')
end

Autotest.add_hook(:initialize) {|at|
  ##at.add_exception %r{^\.git}  # ignore Version Control System
  at.clear_mappings         # take out the default (test/test*rb)

  at.add_mapping(%r%^examples/.*_example.rb$%) { |filename, _|
    filename
  }
  at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
    ["examples/#{m[1]}_example.rb"]
  }
  at.add_mapping(%r%^examples/(example_helper|shared/.*)\.rb$%) {
    at.files_matching %r%^examples/.*_example\.rb$%
  }
	nil
}

2.  Does anyone have a technique for redirecting the output (in my case to MacVim)?  I really only want it to happen if there are errors.  If everything went smoothly, probably a growl notification would be easier.

Thanks!

Sean DeNigris
sean at clipperadams.com

Mac OS X 10.6.2
rspec 1.2.9
ZenTest 4.2.1



More information about the rspec-users mailing list