问题
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!
回答1:
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
来源:https://stackoverflow.com/questions/5109254/spork-is-repeatedly-re-running-failing-tests-in-autotest