Sha256: 1a1caea735ea0dc7f8d57cb7a2cd98c25f76749b831c466e97a0bd37aeea51f1

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Solrizer::Common do
  before do
    class Foo
      include Solrizer::Common
    end
  end
  after do
     Object.send(:remove_const, :Foo)
  end

  let(:solr_doc) { {} }

  it "should handle many field types" do
    Foo.create_and_insert_terms('my_name', 'value', [:displayable, :searchable, :sortable], solr_doc)
    expect(solr_doc).to eq('my_name_ssm' => ['value'], 'my_name_si' => 'value', 'my_name_teim' => ['value'])
  end

  it "should handle dates that are searchable" do
    Foo.create_and_insert_terms('my_name', Date.parse('2013-01-10'), [:stored_searchable], solr_doc)
    expect(solr_doc).to eq('my_name_dtsim' => ['2013-01-10T00:00:00Z'])
  end

  it "should handle dates that are stored_sortable" do
    Foo.create_and_insert_terms('my_name', Date.parse('2013-01-10'), [:stored_sortable], solr_doc)
    expect(solr_doc).to eq('my_name_dtsi' => '2013-01-10T00:00:00Z')
  end

  it "should handle dates that are displayable" do
    Foo.create_and_insert_terms('my_name', Date.parse('2013-01-10'), [:displayable], solr_doc)
    expect(solr_doc).to eq('my_name_ssm' => ['2013-01-10'])
  end

  it "should handle dates that are sortable" do
    Foo.create_and_insert_terms('my_name', Date.parse('2013-01-10'), [:sortable], solr_doc)
    expect(solr_doc).to eq('my_name_dti' => '2013-01-10T00:00:00Z')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solrizer-4.1.0 spec/units/common_spec.rb
solrizer-4.0.0 spec/units/common_spec.rb
solrizer-3.4.1 spec/units/common_spec.rb
solrizer-3.4.0 spec/units/common_spec.rb
solrizer-3.3.0 spec/units/common_spec.rb