With integration testing, the best option, honestly, would be to stub out
ThinkingSphinx since you're more testing the application's functionality,
not ThinkingSphinx. If anything, you would mock out Model.search(*args) to
return an array of models.
In my case, and I'm not saying I did the right thing, I needed to test that
our workling-based delta implementation worked. :)

Matt



On Thu, May 21, 2009 at 6:16 PM, Colin Ramsay <[email protected]>wrote:

>
> Pat, I guess integration tests are really what I meant. Obviously I
> don't want to test TS itself, just the parts of my app which integrate
> with TS. Therefore the context of my tests will be within my app, but
> will involve the results from TS.
>
> Matt, that looks like the kind of thing I was after. I appreciate you
> taking the time to write it up as I'm sure more people than just me
> will find it valuable.
>
> Thanks guys!
>
> On May 21, 7:42 pm, Pat Allan <[email protected]> wrote:
> > Hi Colin
> >
> > Generally I don't recommend testing external libraries (Rails,
> > Thinking Sphinx, etc). The only exception to this would be integration
> > tests - but definitely not in unit tests.
> >
> > As for integration tests, there's no neat way to handle things just
> > yet, but it's on my list.
> >
> > Sorry I'm not flush with helpful ideas :/
> >
> > --
> > Pat
> >
> > On 21/05/2009, at 3:26 AM, Colin Ramsay wrote:
> >
> >
> >
> > > So I was thinking to write a unit test to check that my searching with
> > > Sphinx was working as I expected. I fired up rake
> > > thinking_sphinx:start, and then wrote a test which pushed a couple of
> > > records to the database and then ran Model.search("query"). However,
> > > because the index had not been rebuilt since saving the records and
> > > running the search, I get no results.
> >
> > > What is the recommended approach for this?
> >
> > > Thanks in advance,
> > > Colin.
> >
> >
> >
>


-- 
Matt Todd
Highgroove Studios
www.highgroove.com
cell: 404-314-2612
blog: maraby.org

Scout - Web Monitoring and Reporting Software
www.scoutapp.com

--~--~---------~--~----~------------~-------~--~----~
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