How to write functional testcases for solr

Hi, Am using 'solr_ruby' gem in my rails application for solr search.

But i want to write functional testcases for solr search withouth starting solr externally like as for running application in developmentmode. Is there is anyway to create solr connection and start in testfile only. It's very urgent.Can anybody helpme