You can mock with Ruby really easily, but just overriding methods that would 
otherwise call the server and fake a response.  The solr-ruby library itself 
was built with an extensive test suite doing this.  Here's the mock base:

   
<https://github.com/erikhatcher/solr-ruby-flare/blob/master/solr-ruby/test/unit/solr_mock_base.rb>

You can see its use here:

  
<https://github.com/erikhatcher/solr-ruby-flare/blob/master/solr-ruby/test/unit/connection_test.rb>

        Erik

On Feb 22, 2012, at 05:30 , solr wrote:

> Hi,
> Am using solr_ruby in ruby code for that am starting solr server by using
> start.jsr.
> Now i want to write mockobjects for solr connection and code written in my
> ruby file to search data from solr.
> Can anybody suggest how to do testing without stating solr server
> 
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/how-to-mock-solr-server-solr-sruby-tp3766080p3766080.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to