Sha256: f871ebc7f5d20e0edcf9b21b65b3c253960b969c44eb67c455dee9b8cc904461

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe "An object with RDF backed attributes" do

  before do
    class TestOne < ActiveFedora::Base
      class MyMetadata < ActiveFedora::NtriplesRDFDatastream
        map_predicates do |map|
          map.title(in: RDF::DC) do |index|
            index.as :stored_searchable
          end
          map.date_uploaded(to: "dateSubmitted", in: RDF::DC) do |index|
            index.type :date
            index.as :stored_searchable, :sortable
          end
        end
      end
      has_metadata 'descMetadata', type: MyMetadata
      has_attributes :title, :date_uploaded, datastream: 'descMetadata'
    end
  end

  after do 
    Object.send(:remove_const, :TestOne)
  end

  it "should be able to grab the solr name" do
    expect(TestOne.defined_attributes[:title].primary_solr_name).to eq 'desc_metadata__title_tesim'
  end

  it "should be able to grab the solr name for a date" do
    expect(TestOne.defined_attributes[:date_uploaded].primary_solr_name).to eq 'desc_metadata__date_uploaded_dtsim'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active-fedora-7.0.0.rc2 spec/integration/field_to_solr_name_spec.rb
active-fedora-7.0.0.rc1 spec/integration/field_to_solr_name_spec.rb
active-fedora-7.0.0.pre3 spec/integration/field_to_solr_name_spec.rb
active-fedora-7.0.0.pre2 spec/integration/field_to_solr_name_spec.rb
active-fedora-7.0.0.pre1 spec/integration/field_to_solr_name_spec.rb