Stubbing ThinkingSphinx 'search' method in Rspec

Hello everyone,

I’m trying to test if the ‘search’ method is called with a right params in my controller. When run this right inside my spec:


everything goes fine(no errors). But if try:


get :index, :search => ‘foo’

and the search method ‘called’ inside controller, It falls with this error:

Riddle::ConnectionError in ‘DocumentsController GET index blah blah’

Connection to on 9312 failed. Connection refused - connect(2)

(full stack trace here )

So why it’s even trying to call stubbed method from ThinkingSphinx? I’ve also tried to stub


but results are the same. I use standard Rspec’s stubbing. But also tried with mocha’s stubs() - all the same error.

I don’t really want to do ThinkingSphinx::Test.start and start the daemon, do indexing etc. My environment is:

Ruby 1.8.7 on RVM

Rails 2.3.9

Rspec 1.3.0

Rspec-Rails 1.3.2

ThinkingSphinx 1.4.3

Riddle 1.2.2

Ubuntu Linux 10.04

Any thoughts?