2

I have a new project that I am trying to get up and running with rspec, autotest and spork.

I am using:

  • rails 3.0.4

  • rspec 2.5.0

  • spork 0.9.0.rc3

  • autotest 4.4.6

Spork seems to be loading fine (I get a message that it is listening on a port), but when I run autotest with a failing test, it reruns that test over and over. It should just run the test, see that it is failing and stop. Any idea why this behavior is happening?

Also, once I make the failing tests pass, autotest stops as it should. If I then make a change to the code, the tests don't get run and I need to Ctrl-C to have autotest see the changes.

Thanks for any help!

S.Lott
  • 384,516
  • 81
  • 508
  • 779

1 Answers1

2

Are you sure that this is related to spork? I just fixed a similar problem with autotest and an endless loop, where some component (simplecov in that case) kept updating files in the directory and autotest picked them up as being changed and therefore reran the tests. To solve the problem, find out if spork writes to some file/directory in your tree and add this to the exception list for autotest like so:

~/ruby/project$ cat .autotest
Autotest.add_hook :initialize do |at|
  at.add_exception(%r{^\./\.git})
  at.add_exception(%r{^\./your_culprit})
end

Maybe the docu on github makes it more clear.
Hope this helps

jhwist
  • 15,201
  • 3
  • 40
  • 47
  • I had autotest working before adding spork, so I don't think that is the issue. In any case, I tried creating a .autotest file with the above code. I didn't see any exceptions. Will this file automatically get loaded when I restart autotest? – aaronapayne Feb 24 '11 at 19:48
  • OK, so it looks like the code in the .autotest file is being run, but I am not seeing any exceptions. – aaronapayne Feb 24 '11 at 20:05
  • You are not supposed to see exceptions. The code adds exceptions to the stuff that autotest takes into consideration for detecting changes. And of course you have to modify it to your needs. Please find out if spork writes something, e.g. a logfile or similar. – jhwist Feb 24 '11 at 20:40
  • Thanks for your help on this and sorry for the delay getting back to you. The problem was an issue with .autotest like you said. I had two gems in my Gemfile ("autotest-fsevent","autotest-growl"), but wasn't requiring them in .autotest. After adding them to the .autotest file, the problem went away. – aaronapayne Mar 08 '11 at 23:09