I understood my problem. It was Autotest, not Spork. I switched from a mounted engine to a standard engine (plug-in), as it turned out to be better suited for what I need.
Now I am using the released version of Rails 3.1.
In this case, I decided that everything would be simpler, but I ran into the same problem. In any case, this ended up being fixed for testing an engine with no names (mounted), although with a few ways, I believe this will work.
Add the .autotest file to the project root with the following:
Autotest.add_hook :initialize do |at| at.add_mapping %r%^app/models/(.*)\.rb$% do |_, m| "spec/models/#{m[1]}_spec.rb" end at.add_mapping %r%^app/controllers/(.*)\.rb$% do |_, m| ["spec/controllers/#{m[1]}_spec.rb", "spec/functional/#{m[1]}_spec.rb"] end at.add_mapping %r%^app/helpers/(.*)_helper.rb% do |_, m| ["spec/views/#{m[1]}_view_spec.rb", "spec/functional/#{m[1]}_controller_spec.rb"] end at.add_mapping %r%^app/views/(.*)/% do |_, m| ["spec/views/#{m[1]}_view_spec.rb", "spec/functional/#{m[1]}_controller_spec.rb"] end end
I came up with a solution when I met this answer on another question: how can I tell auto-test to correctly track changes in the application source? as well as other examples found on the Internet.
Hope this helps someone else.
[Change 2011-09-20] The problem with the cucumber / sparkle with "hacking" has been fixed. In the Spork.each_run block, I forcibly reloaded the models and controllers as follows:
ENGINE_ROOT=File.join(File.dirname(__FILE__), '../../')
There seems to be a better way ...