On Feb 9, 1:42 am, Myron Marston <[email protected]> wrote:
> * In my unit specs (both model and controller), TS is mocked out.
> * In my integration tests (using cucumber), I'm actually hitting
> sphinx.

Thanks for your help. I realized that the TS behaviour I have to test
is limited to a few kinds of searches, so I'd better keep them in a
couple basic integration tests and I'll keeping stubbing out TS calls
on unit and functional tests, which are way more extensive. Since
everybody uses cucumber I guess I will finally study it.

>
> > User.stubs(:search).returns(User.all)
>
> Be careful about using a dynamic value such as User.all in your
> stubbing--suddenly, you're coupling your tests to what's present in
> your database, and you may unknowingly create a dependency such that
> adding or removing a record from your fixtures causes this test to
> fail.

Got your point, actually I'm using something like this

user = Factory.create(:user)
User.stubs(:search).returns(user)

which should be reasonably safe.
Thanks everybody


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