Ah. Just used a wrong model name. I should've been using
DocumentContent instead of Document for stubbing.

Everything works fine now thanks

On Thu, May 5, 2011 at 5:29 AM, Pat Allan <[email protected]> wrote:
> Hi Vladimir
>
> What does your index action look like?
>
> Cheers
>
> --
> Pat
>
> On 05/05/2011, at 2:44 AM, Vladimir Rybas wrote:
>
>> 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:
>>
>>         Document.stub!(:search).and_return([@document])
>>         Document.search
>>
>> everything goes fine(no errors). But if try:
>>
>>         Document.stub!(:search).and_return([@document])
>>         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 127.0.0.1 on 9312 failed. Connection refused - connect(2)
>> (full stack trace here 
>> http://pastie.org/pastes/1864689/text?key=1vlusmdf1xer2tz1ve7pvg )
>>
>> So why it's even trying to call stubbed method from ThinkingSphinx? I've 
>> also tried to stub
>>
>>        ThinkingSphinx::Search.stub!(:search)
>>
>> 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?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Thinking Sphinx" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/thinking-sphinx?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to