MetaSkills.net

Using Autotest For Rails Plugin Development

Posted On: September 19th, 2008 by kencollins

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

Jamie Hill

  HOMEPAGE  | September 24th, 2008 at 07:53 PM
Jamie Hill I use a simpler, yet not quite as flexible approach outlined here: http://www.thelucid.com/articles/2007/07/24/using-autotest-when-developing-rails-plugins

Ken Collins

  HOMEPAGE  | September 24th, 2008 at 10:52 PM
Ken Collins @Jamie Thanks for sharing. I too am working on adding a few more mappings that will fix the unable to map the class to a file. So far I am not 100% where I want this to be. For instance, if a test fails, then passes, the whole suite is not run again. But I will fix that shortly.

Leave a Comment

Name (required)
Email (will not be published)
Website
Comment