Wednesday, January 7, 2009

autotest with specs in a normal ruby library

Put this in a '.autotest' file in your project's base directory:

# -*- ruby -*-

# in .autotest file:

Autotest.add_hook :initialize do |at|
at.clear_mappings
end

Autotest.add_hook :initialize do |at|
at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
["spec/#{m[1]}_spec.rb"]
## for both specs and tests:
#["spec/#{m[1]}_spec.rb","test/#{m[1]}_test.rb"]
}
end

No comments: