Sha256: 1356a04a965c5be82c12b1dff593ee9b236d4489b1c454696ac47f8eb2cd970c
Contents?: true
Size: 1.38 KB
Versions: 8
Compression:
Stored size: 1.38 KB
Contents
require 'spec_helper' describe ActiveFedora::SolrHit do before do class Foo < ActiveFedora::Base has_metadata 'descMetadata', type: ActiveFedora::SimpleDatastream do |m| m.field "foo", :text m.field "bar", :text end Deprecation.silence(ActiveFedora::Attributes) do has_attributes :foo, datastream: 'descMetadata', multiple: true has_attributes :bar, datastream: 'descMetadata', multiple: false end property :title, predicate: ::RDF::Vocab::DC.title, multiple: false end end let(:another) { Foo.create } let!(:obj) { Foo.create!( id: 'test-123', foo: ["baz"], bar: 'quix', title: 'My Title' ) } let(:profile) { { "foo" => ["baz"], "bar" => "quix", "title" => "My Title" }.to_json } let(:doc) { { 'id' => 'test-123', 'has_model_ssim' => ['Foo'], 'object_profile_ssm' => profile } } let(:solr_hit) { described_class.new(doc) } after do Object.send(:remove_const, :Foo) end describe "#reify" do subject { solr_hit.reify } it "finds the document in solr" do expect(subject).to be_instance_of Foo expect(subject.title).to eq 'My Title' end end describe "#instantiate_with_json" do subject { solr_hit.instantiate_with_json } it "finds the document in solr" do expect(subject).to be_instance_of Foo expect(subject.title).to eq 'My Title' end end end
Version data entries
8 entries across 8 versions & 1 rubygems