Sha256: 5b87d17af8704a2ec28af851f7df55f7f6d35674ead0b12ccb6d9f865e0c65e7
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
require 'spec_helper' describe ActiveFedora::SolrService do describe "#reify_solr_results" do before(:each) do class FooObject < ActiveFedora::Base def self.id_namespace "foo" end has_metadata :name => "descMetadata", :type => 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 @test_object.delete @foo_object.delete Object.send(:remove_const, :FooObject) end it "should return an array of objects that are of the class stored in active_fedora_model_s" do query = "id\:#{RSolr.escape(@test_object.id)} OR id\:#{RSolr.escape(@foo_object.id)}" solr_result = ActiveFedora::SolrService.query(query) result = ActiveFedora::SolrService.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 'should #reify a lightweight object as a new instance' do query = "id\:#{RSolr.escape(@foo_object.id)}" solr_result = ActiveFedora::SolrService.query(query) result = ActiveFedora::SolrService.reify_solr_results(solr_result,{:load_from_solr=>true}) expect(result.first).to be_instance_of FooObject end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active-fedora-9.0.0.beta2 | spec/integration/solr_service_spec.rb |
active-fedora-9.0.0.beta1 | spec/integration/solr_service_spec.rb |