Sha256: 8ede26622ed190ade18e725b92fff61477a7e61dbf0992c86b602362e5735ac7

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe RSolr::Direct do
  
  context 'initialization' do
    
    it 'should modifiy RSolr' do
      RSolr.should be_a(RSolr::Direct::Connectable)
    end
    
    it 'should not change the default connect behavior' do
      RSolr.connect.connection.should be_a(RSolr::Connection::NetHttp)
    end
    
    it 'should attempt to use a direct connect if :solr_home is set but raise a MissingRequiredJavaLibs' do
      lambda{
        RSolr.connect(:solr_home=>'')
      }.should raise_error(RSolr::Direct::Connection::MissingRequiredJavaLibs)
    end
    
    it 'should attempt to use a direct connect if :solr_home is set but raise a InvalidSolrHome' do
      load_required_java_libs
      lambda{
        RSolr.connect(:solr_home=>'')
      }.should raise_error(RSolr::Direct::Connection::InvalidSolrHome)
    end
    
    it 'should create direct connection succesfully' do
      load_required_java_libs
      RSolr.connect(:solr_home=>solr_home_dir).connection.should be_a(RSolr::Direct::Connection)
    end
    
    it 'should accept a Java::OrgApacheSolrCore::SolrCore' do
      load_required_java_libs
      core = new_solr_core solr_home_dir, solr_data_dir
      rsolr = RSolr.connect(core)
      rsolr.should be_a(RSolr::Client)
      rsolr.connection.should be_a(RSolr::Direct::Connection)
      core.close
    end
    
    it 'should accept a Java::OrgApacheSolrServlet::DirectSolrConnection' do
      load_required_java_libs
      dc = new_direct_solr_connection solr_home_dir, solr_data_dir
      rsolr = RSolr.connect(dc)
      rsolr.should be_a(RSolr::Client)
      rsolr.connection.should be_a(RSolr::Direct::Connection)
      dc.close
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsolr-direct-0.0.0 spec/rsolr-direct_spec.rb