I always have to hunt for these, so here they are in one place.
Cribbed together from random blog posts from places:
- David Chelimsky's blog entry about the features
- Mike Subelsky's entry about autotest -v
- Random use of the Googles
| # Actually .autotest and lives at the root of your project, from where you execute autotest | |
| # this is all done in a hook, like this: | |
| Autotest.add_hook :initialize do |at| | |
| # i don't like the default exceptions, get rid of them! | |
| at.clear_exceptions | |
| # exclude stuff that changes between each test, like log | |
| at.add_exception('log/') | |
| # i don't like the default mappings, get rid of them! | |
| at.clear_mappings | |
| # watch some files in addition to what your test framework discovery declares | |
| at.add_mapping(%r{some/testable/code/(.*)\.rb}, true) do |filename, matches| | |
| # the true is to prepend this to the list of matches, leave it blank to append | |
| # this block expects and array of file paths to add to the command line executed | |
| # this will essentially do Dir[whatever] for you, except with a regexp. | |
| # oh yeah, and add that additional file we need to run in the test suite: | |
| at.files_matching(%r{tests/for/my/code/#{matches[1]}_test.rb}) + [ 'some/crazy/test/thing_test.rb' ] | |
| end | |
| end | |
| # discoveries define a set of matchings and exceptions | |
| # you override those with .autotest | |
| Autotest.add_discovery { "rspec2" } # or whatever your testing framework provides | 
I always have to hunt for these, so here they are in one place.
Cribbed together from random blog posts from places: