You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by solr <la...@gmail.com> on 2012/02/22 11:30:05 UTC

how to mock solr server solr_sruby

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.

Re: how to mock solr server solr_sruby

Posted by Erik Hatcher <er...@gmail.com>.
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.