Sha256: 6e7ae45ebc82f7b8b3e812b7fe20de110d05f119f84d5a6f67baf86ab55295f8

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'solrizer'

describe Solrizer::XML::Extractor do
  
  before(:all) do
    @extractor = Solrizer::Extractor.new
  end
  
  describe ".xml_to_solr" do
    it "should turn simple xml into a solr document" do
      desc_meta = fixture("druid-bv448hq0314-descMetadata.xml")
      result = @extractor.xml_to_solr(desc_meta)
      result[:type_t].should == "text"
      result[:medium_t].should == "Paper Document"
      result[:rights_t].should == "Presumed under copyright. Do not publish."
      result[:date_t].should == "1985-12-30"
      result[:format_t].should == "application/tiff"
      result[:title_t].should == "This is a Sample Title"
      result[:publisher_t].should == "Sample Unversity"

      # ... and a hacky way of making sure that it added a field for each of the dc:medium values
      result.inspect.include?('@value="application/tiff"').should be_true
      result.inspect.include?('@value="application/pdf"').should be_true
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solrizer-1.0.0 spec/units/xml_extractor_spec.rb
solrizer-0.3.2 spec/units/xml_extractor_spec.rb
solrizer-0.3.1 spec/units/xml_extractor_spec.rb
solrizer-0.3.0 spec/units/xml_extractor_spec.rb