Testing controllers

Hi all
i m having a tough time testing my controllers, some different cases:

  1. def spCodes
    @sp_codes = Code.get_sp_code(params[:id], 0, 100)

  2. def search
    @matcher = request.raw_post || request.query_string
    @code = Code.search(@matcher)

i am getting nil objects for both of methods,
can anybody help …

thanks