29-small Fixing my autotest after switching to Rails 3.1.0

posted by joanwolk May 24, 2011 @ 7:49 PM • 0 comments

in

[cross-posted from git init and get in it]

In my last post, I complained about autotest being broken. Well, it’s not actually broken. I’ve just fixed my problem, and it turned out to be one of the perils of the way I went about the conversion of my project to the new version of Rails, and not at all related to the Rails upgrade or the autotest gems.

The Missing Piece

The missing piece was that in my new project folder, I didn’t have a .rspec file. That file contains one crucial line of code, --drb. That’s all. (Ok, I actually have a second line in mine, --color to show red/yellow/green for fail/pending/pass, but that’s not the important part.)

That one invisible file with the one short line of code is, approximately, the connection that allows spork to load the project for testing and allows autotest to recognize the location of the tests. The rspec wiki page regarding autotest explains that having a .rspec file in the project root “tells RSpec to tell Autotest to load RSpec’s autotest extension.” Thank goodness I found the advice of the third responder on a year-old StackOverflow question!

How It Happened

This problem was only tangentially related to my Rails version upgrade. Because I created a fresh project and copied over only the relevant bits of the code, it was easy for me to miss the invisible .rspec file. (For my fellow noobs, any file or folder beginning with a period will be invisible in the default file navigation view of your system. A lot of system files are named this way to prevent people accidentally altering them.) By copying over most of the code I needed, I may have actually blocked myself a bit. I think that if I had set up RSpec properly, it would have created the file for itself based on my system-wide preferences for it. The dangers of cutting corners, eh?

Comments

Create a free account to comment on this post!

There are currently no comments.

Log In



 

Join Us










What month comes before July?

By submitting this form, you agree to the site's terms of use and confirm that you are at least 13 years old.

Search Us

Promote & Share

RSS delicious facebook twittter stumbleupon

Follow us on Facebook