Sha256: 0d8e7f3e27baa4d78219ab1015a5f7c6980efd2ecf465d3d211fa5308252c130

Contents?: true

Size: 1.2 KB

Versions: 14

Compression:

Stored size: 1.2 KB

Contents

require File.join(File.dirname(__FILE__), 'spec_helper')

describe 'indexing dynamic fields' do
  it 'indexes string data' do
    session.index(post(:custom_string => { :test => 'string' }))
    connection.should have_add_with(:"custom_string:test_s" => 'string')
  end

  it 'indexes integer data with virtual accessor' do
    session.index(post(:category_ids => [1, 2]))
    connection.should have_add_with(:"custom_integer:1_i" => '1', :"custom_integer:2_i" => '1')
  end

  it 'indexes float data' do
    session.index(post(:custom_fl => { :test => 1.5 }))
    connection.should have_add_with(:"custom_float:test_fm" => '1.5')
  end

  it 'indexes time data' do
    session.index(post(:custom_time => { :test => Time.parse('2009-05-18 18:05:00 -0400') }))
    connection.should have_add_with(:"custom_time:test_d" => '2009-05-18T22:05:00Z')
  end

  it 'indexes boolean data' do
    session.index(post(:custom_boolean => { :test => false }))
    connection.should have_add_with(:"custom_boolean:test_b" => 'false')
  end

  it 'indexes multiple values for a field' do
    session.index(post(:custom_fl => { :test => [1.0, 2.1, 3.2] }))
    connection.should have_add_with(:"custom_float:test_fm" => %w(1.0 2.1 3.2))
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
benjaminkrause-sunspot-0.9.7 spec/api/indexer/dynamic_fields_spec.rb
benjaminkrause-sunspot-0.9.8 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.9 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.8 spec/api/indexer/dynamic_fields_spec.rb
nxa-sunspot-0.10.7 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.7 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.6 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.5 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.4 spec/api/indexer/dynamic_fields_spec.rb
kuahyeow-sunspot-0.10.3 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.3 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.2 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.1 spec/api/indexer/dynamic_fields_spec.rb
sunspot-0.10.0 spec/api/indexer/dynamic_fields_spec.rb