Sha256: 5fe62abd2a6595e9305692cbea0603757cf6b379d89abbd0d01013605290378e

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

RSpec.describe ActiveFedora::Indexing::Inserter do
  let(:solr_doc) { {} }

  it "handles many field types" do
    described_class.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 "handles dates that are searchable" do
    described_class.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 "handles dates that are stored_sortable" do
    described_class.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 "handles dates that are displayable" do
    described_class.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 "handles dates that are sortable" do
    described_class.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

6 entries across 6 versions & 1 rubygems

Version Path
active-fedora-12.0.3 spec/unit/active_fedora/indexing/inserter_spec.rb
active-fedora-12.1.1 spec/unit/active_fedora/indexing/inserter_spec.rb
active-fedora-12.1.0 spec/unit/active_fedora/indexing/inserter_spec.rb
active-fedora-12.0.2 spec/unit/active_fedora/indexing/inserter_spec.rb
active-fedora-12.0.1 spec/unit/active_fedora/indexing/inserter_spec.rb
active-fedora-12.0.0 spec/unit/active_fedora/indexing/inserter_spec.rb