Sha256: 17e83c7d8de78f8240fe26bbf2f346d440ef743058ae503eebc81e0d9e8b6a2c

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'helper'

class TestJrubyStreamingUpdateSolrServer < Test::Unit::TestCase
  should "Write some tests, but don't know how to mock up a solr server" do
    assert_equal 1, 1
  end

  should "Report nil for a document that doesn't include a field" do 
    doc = SolrInputDocument.new
    assert_equal nil, doc[:notinthere]
  end
  
  should "Return single and multiple values in arrays" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    assert_equal [1], doc[:id]
    doc << [:id, 2]
    assert_equal [1,2], doc[:id]
  end
  
  should "Add items in hash via merge!" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    h = {:id => 2, :name => 'Bill'}
    doc.merge! h
    assert_equal [1,2], doc[:id]
    assert_equal ['Bill'], doc[:name]
  end
  
  should "Allow additive_merge! as well" do
    doc = SolrInputDocument.new
    doc << [:id, 1]
    h = {:id => 2, :name => 'Bill'}
    doc.additive_merge! h
    assert_equal [1,2], doc[:id]
    assert_equal ['Bill'], doc[:name]
    
  end
  
  should "Destroy existing items via []=" do
    doc = SolrInputDocument.new
    doc[:id] = 1
    assert_equal [1], doc[:id]
    doc[:id] = 2
    assert_equal [2], doc[:id]
  end    
    

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jruby_streaming_update_solr_server-0.3.1 test/test_jruby_streaming_update_solr_server.rb