Topic: test case for rspec

I want test case in rspec for:
@drugs = Drug.where('drug_category_id = ?', params[:id])
Please help me...

Re: test case for rspec

drug = model_stub(Drug)
id = the_id_you_will_use_for_the_page_request
Drug.should_receive(:where).with(id).and_return([drug])

:get ....
assigns(:drug).should == drug

Or something close to that. smile

Last edited by Endrju (2010-11-30 22:25:14)