Sha256: c842df10c0330fecd4c62ba3d5f4bffd6c0312551b03af777dbedc60faaa882e

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'test_unit_test_case'
require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
require 'helper'

class RSolrExtConnectionTest < Test::Unit::TestCase
  
  test 'the #connect method' do
    connection = RSolr::Ext.connect
    assert connection.respond_to?(:find)
  end
  
  test 'the #find method' do
    connection = RSolr::Ext.connect
    response = connection.find 3, 10, :q=>'*:*'#, :page=>1, :per_page=>10
    assert response.kind_of?(Mash)
    #r = connection.find 3, 5, :q=>'*:*', :phrase_queries=>'rose'
    #assert ! r.header[:params].include?(:phrase_queries)
  end
  
  test 'the #find method with a custom request handler' do
    connection = RSolr::Ext.connect
    response = connection.find '/select', :q=>'*:*'
    assert response.raw[:path]=~/\/select/
  end
  
  test 'the response' do
    connection = RSolr::Ext.connect
    response = connection.find :q=>'*:*'
    assert response.respond_to?(:ok?)
    assert response.ok?
    assert_equal response.docs[0][:id], response.docs[0].id
  end
  
  test 'the #luke method' do
    info = RSolr::Ext.connect.luke
    assert info.kind_of?(Mash)
    assert info.key?('fields')
    assert info.key?('index')
    assert info.key?('info')
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rsolr-ext-0.11.0 test/connection_test.rb