views:

200

answers:

2

Running either $autotest or $autotest -f gives the same result:

# Waiting since [timestamp]

Changing a controller or spec file just gets that line repeated (with a newer timestamp). If I try $autotest -v, it does not include the spec or controller among the list of files for which no tests match, which I suppose is good; but it doesn't show anything else besides the #waiting line.

If I make a change to a spec or controller while running -v, the output is a hash repeated twice with {[path/to/changed/file] => [timestamp]}.

This is Ubuntu 9.04, Ruby 1.9.2, Rails 3, autotest 4.3.2, autotest-rails 4.1.0, and rspec 2.0.0.beta.20. (I should also say that rspec /spec on its own works fine.) Any ideas?

A: 

I have the exact same environment, except Windows instead of Ubuntu. I am having the same problem. I determined that it is not actually using the rails_app/autotest/discover.rb I setup like this (tried changing order, didn't matter, added output statements and they never got run.):

Autotest.add_discovery { "rspec2" }
Autotest.add_discovery { "rails" }

I found the solution:

in my Gemfile for bundler I had specified ZenTest, and needed to swap it out for these beauties (autotest-rails depends on ZenTest, but this made all the difference):

gem 'autotest'
gem 'autotest-rails'

And now it works (almost but at least now I have an unrelated 'Windowsy' problem). I think this will help you!

Well autotest, still doesn't work, but bundle exec autotest does, and that's good enough!

Peter H. Boling
Alas, that's not it for me. I had 'autotest' in the Gemfile, and adding 'autotest-rails' just got me to an error related to the fact that I'm using the mynyml-redgreen gem instead of redgreen. Thanks though!
bgates
"autotest" + "autotest-rails-pure" works for me.
Tim
The redgreen gem (all flavors) should be taken out of your stack with RSpec2, as it does it's own coloring. That could well be your problem. I've read of people having that issue elsewhere.RSpec2 coloring explained at the bottom of this wiki: http://github.com/dchelimsky/rspec/wiki/autotest-integrationAnd now I see you've solved it on your own. Really though, take out redgreen. :)
Peter H. Boling
A: 

Aha! I was doing this as part of my first experiment with rvm, but I had ZenTest as a gem in /usr/lib/ruby. Even after I set 'rvm use _' to the gemset I wanted - the one with the autotest and autotest-rails-pure gems - the command 'autotest' was still picking up the file at /usr/bin/autotest that the older ZenTest had put in place. So for anybody following the railstutorial.org - make sure you don't have gems from pre-rvm use (or from sudo gem installs) that are leaving files in places you don't expect.

For me, 'sudo gem uninstall ZenTest' turned out to do the trick.

bgates