Sha256: b21eb96274d8d465d70dfee927ca82f8ae5edf381cded8f8fe97de7b87076524
Contents?: true
Size: 1.94 KB
Versions: 15
Compression:
Stored size: 1.94 KB
Contents
require 'spec_helper' describe ActiveFedora::QueryResultBuilder do describe "#reify_solr_results" do before(:each) do class FooObject < ActiveFedora::Base def self.id_namespace "foo" end has_subresource :descMetadata, class_name: 'ActiveFedora::QualifiedDublinCoreDatastream' end @test_object = ActiveFedora::Base.new @foo_object = FooObject.new attributes = { "language" => { 0 => "Italian" }, "creator" => { 0 => "Linguist, A." }, "geography" => { 0 => "Italy" }, "title" => { 0 => "Italian and Spanish: A Comparison of Common Phrases" } } @foo_object.descMetadata.update_indexed_attributes(attributes) @test_object.save @foo_object.save @profiles = { # 'test' => @test_object.profile, # 'foo' => @foo_object.profile, # 'foo_descMetadata' => @foo_object.datastreams['descMetadata'].profile } @foo_content = @foo_object.attached_files['descMetadata'].content end after(:each) do Object.send(:remove_const, :FooObject) end it "returns an array of objects that are of the class stored in active_fedora_model_s" do query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([@test_object.id, @foo_object.id]) solr_result = ActiveFedora::SolrService.query(query) result = described_class.reify_solr_results(solr_result) expect(result.length).to eq 2 result.each do |r| expect((r.class == ActiveFedora::Base || r.class == FooObject)).to be true end end it '#reifies a lightweight object as a new instance' do query = ActiveFedora::SolrQueryBuilder.construct_query_for_ids([@foo_object.id]) solr_result = ActiveFedora::SolrService.query(query) result = described_class.reify_solr_results(solr_result, load_from_solr: true) expect(result.first).to be_instance_of FooObject end end end
Version data entries
15 entries across 15 versions & 1 rubygems