Ben Mabey wrote:
> Pat Maddox wrote:
>>>
>> _______________________________________________
>> rspec-users mailing list
>> [email protected]
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>
>
> Also, what is your data? The matcher may not work as expected due to
> nuances in your data. For example, STI tends to mess things up in cases
> like this.
>
> -Ben
Thanks guys. The problem is that it simply doesn't fail when I expect it
to. If I remove the call to the :inactive_user fixture (i.e. I'm
checking that the results should not include any of the 'users' at all),
it still passes. This is the spec in full;
describe "handling GET /searches/people" do
def do_get
ThinkingSphinx::Search.stub!(:search).and_return(users)
get :people, :search => "bob"
end
it "should be successful" do
do_get
response.should be_success
end
it "should render people template" do
do_get
response.should render_template('people')
end
it "should assign an array of user results" do
do_get
assigns[:results].should_not be_nil
end
it "should not include any inactive users in an assigned array of user
results " do
do_get
assigns[:results].should_not include(users(:inactive_user))
end
it "should not include any banned users in an assigned array of user
results " do
do_get
assigns[:results].should_not include(users(:banned))
end
end
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
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users