Hi all,
  I'm writing an integration tests using test:unit and capybara w/ 
poltergeist. One of the elements on a page I'm testing is an autocomplete 
search box, which uses Sphinx and jQuery's autocomplete plugin. It all 
works fine in both development and production, but not for my tests. 
Basically, by taking screen shots using poltergeist, I can see that the 
test fills in search box and it does open up a list of options (meaning 
that it was able to connect to searchd?), but then as soon as the option 
gets clicked, the test fails, citing "Connection to 127.0.0.1 on 9313 
failed. Connection refused - connect(2)". The test also takes an incredibly 
long time. Like more than double the time without TS. As far as I can tell 
from the TS documentation sites, I've got everything set up correctly. 
Here's the setup:

*sphinx.yml:*
development:
  port: 9312
test:
  port: 9313

*test_helper.rb:*
...
require 'thinking_sphinx/test'
...
class ActionDispatch::IntegrationTest
  # Make the Capybara DSL available in all integration tests
  include Capybara::DSL
  WebMock.allow_net_connect!

  # Stop ActiveRecord from wrapping tests in transactions
  self.use_transactional_fixtures = false
  
  # Initialize and index Thinking Sphinx
  ThinkingSphinx::Test.init
  ThinkingSphinx::Test.index

  teardown do
    DatabaseCleaner.clean       # Truncate the database
    Capybara.reset_sessions!    # Forget the (simulated) browser state
    Capybara.use_default_driver # Revert Capybara.current_driver to 
Capybara.default_driver
  end
end

*auto_test:*
ThinkingSphinx::Test.run do
  within 'li.vehicle-1' do
    fill_in 'search', with: '2012 Ford Escape'
    page.execute_script("$('li.vehicle-1 
input[name=search]').trigger('keydown')")
    page.execute_script("$('.ui-menu-item a:contains(\"2012 Ford Escape 
Limited\")').trigger(\"mouseenter\").click()")
  end
end

I've been banging my head against this all day... Anybody have an idea of 
where I should investigate from here? Any and all help is appreciated!!

Thanks,

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to