I normally stub the search call and return some test doubles representing ActiveRecord models - if I care about the arguments, then I set expectations on those as well.
--
Pat
On 09/10/2012, at 9:23 PM, prajwal wrote:
> I'm trying to perform some unit tests on modules that rely heavily on Sphinx. What's the recommended way to mock sphinx in these cases?
>
> At the moment, I'm just mocking out the search method for the model to return whatever I tell it to return. It works for now, but I want to automate it. Is there a way or a more advanced sphinx mock that can create create indices on demand from models that I manually pass to it, and perform search only on those models?
>
> Something like:
> sphinx_mock.index([profile1,profile2,profile3])
> result = sphinx_mock.search({criteria => { Profile.id => 1 } })
> assert_equal profile1, result.first
>
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/vPE66IJy9dAJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.