Hi, I've similar issue with tests and Thinking Sphinx with Real Time 
indices.
I've a test helper: sphinx_helper.rb like this:

module SphinxHelper
  def init_thinking_sphinx
    delete_indeces_files
    ThinkingSphinx::Test.init
    ThinkingSphinx::Test.start_with_autostop
    generate
  end

  def generate
    
ActiveSupport::Notifications.unsubscribe('start_populating.thinking_sphinx.real_time')
    
ActiveSupport::Notifications.unsubscribe('populated.thinking_sphinx.real_time')
    
ActiveSupport::Notifications.unsubscribe('finish_populating.thinking_sphinx.real_time')
    indices = ThinkingSphinx::Configuration.instance.indices.select { 
|index| index.type == 'rt' }
    indices.each do |index|
      ThinkingSphinx::RealTime::Populator.populate index
    end
  end

  def delete_indeces_files
    # FileUtils.rm_rf(ThinkingSphinx::Test.config.indices_location)
    Dir[Rails.root.join(ThinkingSphinx::Test.config.indices_location, 
'*.{meta,ram}')].each do |file|
      FileUtils.rm_rf(file)
    end
  end

end

In tests that use ts in setup method I call the method init_thinking_sphinx 
that 
delete indices, init ts, start ts and generate indices. All seems works if 
I run unit tests and integration tests separately. But if I run all my test 
(unit and integration) with rake test I get the error 
ThinkingSphinx::Search::StaleIdsException: 
Record IDs found by Sphinx but not by ActiveRecord ONLY on integration test 
that use thinking sphinx. If I run integration tests alone, I get no errors.

Thx for reply!

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to