Ruby, JavaScript, Sass, iOS. Stinky Cheese & Beer Advocate. Working at CustomInk and loving it!

Using Autotest For Rails Plugin Development

I love autotest. I have event posted before how to extend the idea of autotest sounds to a red/green playlist but now that I am taking more time to extract some of my work to plugins, I really wanted autotest to come with me. The problem is that the default autotest mappings do not play with rails conventions, the biggest being that test files for a lib match the name of the lib with _test.rb at the END of the filename.

Today I posted a new project to my Github account, called Autotest::Railsplugin. This project should be a great start for fleshing out all the typical mappings, ignore, libs, etc. that autotest needs to know about when developing a rails plugin. I invite you to download it and give it a try and provide feedback on missing details.

To Install

  • Download
  • Rename the directory to "autotest"
  • Place inside of your plugin’s root directory.
  • From your plugin root, you can now use autotest.
$ autotest
loading autotest/railsplugin

By default, autotest will scan your present working directory for an autotest folder that has a discover.rb in it. So it should find and display the loading autotest/railsplugin which means it found the plugin class just fine. If this is not the case make sure you have the directory named correctly. If you have a conflicting autotest directory for some reason you can always force the plugin class, again assuming you have it in the right, place using:

$ autotest -railsplugin

Resources