[rspec-users] Spec for 'an array should not include an item'

Pat Maddox pergesu at gmail.com
Wed Oct 1 10:29:51 EDT 2008


Neil Cauldwell <lists at ruby-forum.com> writes:
> Is my stubbing breaking this? I hope not because Thinking SPhinx isn't 
> determining the scope of the search in relation to the 'active' state of 
> the users; the search is built on top of a named scope on the User 
> model;
>
>   # GET /searches/people
>   # GET /searches/people.xml
>   def people
>     @results = User.active.search params[:search], :page => 
> params[:page], :per_page => 15
>
>     respond_to do |format|
>       format.html
>       format.xml  { render :xml => @results }
>     end
>   end
>
> Cheers

You're stubbing User.search, but you don't actually call it.  search
ends up being called on a named_scope collection proxy.  So I think that
this is using the real implementation of both active and search.

I never saw you post a failure message, so I'm not actually sure what
problem you're having.  A failure message would be helpful.

Pat


More information about the rspec-users mailing list