Development

Autotest Your Rails Apps

UPDATE: I’ve noticed that autotest seems to require complete restarts for similar reasons to the rails server. If you don’t restart it, it will report a slew of false errors.


Do this:

$ sudo gem install ZenTest autotest-rails autotest-fsevent
    autotest-growl redgreen

Edit ~/.autotest (create it if it doesn’t exist) and add the following:

require 'autotest/fsevent'
require 'autotest/growl'
require 'redgreen/autotest'

If you want autotest to skip certain paths, you can add something like the following to ~/.autotest as well (thanks to Bitcetera):

Autotest.add_hook :initialize do |autotest|
  %w{.git .svn .hg .DS_Store ._* vendor}.each do |exception|
    autotest.add_exception(exception)
  end
  false
end

Then run autotest for your rails app:

$ cd myrailsapp
$ autotest