Sha256: 1fc5cf29dc701ddd0dd1e5a1df3c9f6f293f75eea05c0ab7fd74c5e273134076
Contents?: true
Size: 1.22 KB
Versions: 5
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' describe ActiveFedora::QueryResultBuilder do describe "#reify_solr_results" do before do class FooObject < ActiveFedora::Base def self.id_namespace "foo" end end end let(:test_object) { ActiveFedora::Base.create } let(:foo_object) { FooObject.create } 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
5 entries across 5 versions & 1 rubygems