Rspec and autotest

September 17th, 2007

I thought I’d mention this briefly as rspec is becoming a very popular way to test. I was manually running my tests until I was recently pointed in the direction of auto-test with spec_server. This significantly increases the feedback loop for when your tests pass and fail; increasing productivity exponentially. The steps are as follows:

Install ZenTest:

sudo gem install ZenTest

Install rspec for rails:

http://rspec.rubyforge.org/documentation/rails/install.html

Open up a terminal and open run script/spec_server from the root of your rails application. Then open up another terminal and run autotest -rails (also inside of the root of the rails application). Edit a spec to make it fail, save it and watch autotest tell you it failed! I know you can get this to work with growl (I’m on Ubuntu so I don’t use growl). If someone with OS X experience can comment on how to get growl integrated and perhaps provide an alternative for linux, I will post it up.

3 Responses to “Rspec and autotest”

  1. Lance Carlson Says:
    actually, is the best way to use rake spec:autotest and/or rake spec:autotest:rails? Do they work better than this method and if so.. which one?
  2. James Deville Says:
    I figured I could toss out my post on growl with autotest. Also, I believe there is a utility called libNotify that can be used on Linux. While Googling it, I also found out about a newish project called "Mumbles" on SourceForge. Have fun ya'll
  3. Lance Carlson Says:
    I think I used your growl example to do the same thing with Ubuntu Gnome's default notifier called libnotify-bin. With that installed, all you have to do is run notify-send and it will show up like growl. I had to tweak it to do what I wanted obviously but it works like a charm. I may post a thing on it later. What I don't like though is that it only shows you whether or not the test fails. This still forces you to look at the terminal for errors. It would be nice to be able to populate the notifiers (growl and notify-send) with the actual error report after autotest triggers a diff. If there is a hook somewhere that allows you to do that, let me know!

Sorry, comments are closed for this article.