I avoid the issue by using flexmock to verify that search is called
with the expected parameters and do not test that search returns
expected values since thinking_sphinx and sphinx itself are tested
separately. After all, you are testing your models and controllers,
not sphinx. For example:
q = 'pdi'
flexmock(Post).should_receive(:search).once.with(q).and_return do
posts = []
WillPaginate::Collection.create(1, posts.size > 0 ? posts.size :
Post.per_page, posts.size) do |pager|
pager.replace(posts)
pager.total_entries = posts.size unless pager.total_entries
end
end
On Aug 24, 6:45 pm, mix <[email protected]> wrote:
> Hi, i test all my application with unit and integration tests. How can
> i rebuild automatically the indexes at the start of every test (maybe
> just the one i choose, to avoid waste of time for an unused reindex).
> Actually when I do a Model.search the results are 0, also if in the
> fixtures there are some. With ferret i used Model.rebuild_index at the
> start of the method. Is there something with sphinx too? How do you do
> the testing?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---