active-fedora 1.1.2 → 1.1.4.pre2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{README.txt → README.textile} +12 -22
 - data/Rakefile +3 -0
 - data/VERSION +1 -1
 - data/active-fedora.gemspec +9 -6
 - data/lib/active_fedora.rb +2 -1
 - data/lib/active_fedora/base.rb +25 -9
 - data/lib/active_fedora/content_model.rb +52 -0
 - data/lib/active_fedora/datastream.rb +7 -4
 - data/lib/active_fedora/metadata_datastream.rb +6 -3
 - data/lib/active_fedora/qualified_dublin_core_datastream.rb +7 -5
 - data/lib/active_fedora/rels_ext_datastream.rb +7 -6
 - data/lib/fedora/repository.rb +4 -1
 - data/spec/{samples → fixtures}/oh_qdc.xml +0 -0
 - data/spec/integration/base_loader_spec.rb +2 -1
 - data/spec/unit/content_model_spec.rb +51 -0
 - data/spec/unit/datastream_spec.rb +2 -2
 - data/spec/unit/mods_datastream_spec.rb +289 -0
 - data/spec/unit/nokogiri_datastream_spec.rb +301 -0
 - data/spec/unit/qualified_dublin_core_datastream_spec.rb +12 -9
 - data/spec/unit/rels_ext_datastream_spec.rb +4 -3
 - metadata +16 -11
 
| 
         @@ -1,37 +1,27 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            h2. Description
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            RubyFedora and ActiveFedora provide a set of Ruby gems for creating and managing objects in the Fedora Repository Architecture (http://fedora-commons.org).
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            h2. Getting Help
         
     | 
| 
       2 
6 
     | 
    
         | 
| 
       3 
7 
     | 
    
         
             
            * http://yourmediashelf.com/activefedora
         
     | 
| 
       4 
8 
     | 
    
         
             
            * Project Homepage: <http://yourmediashelf.com/activefedora>
         
     | 
| 
       5 
9 
     | 
    
         
             
            * Further documentation is available at <http://projects.mediashelf.us/show/active-fedora>
         
     | 
| 
       6 
10 
     | 
    
         
             
            * Community Discussions & Mailing List are located at <http://groups.google.com/group/active-fedora>
         
     | 
| 
       7 
11 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            * http://rubyforge.org/projects/rubyfedora/
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            == DESCRIPTION:
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            RubyFedora and ActiveFedora provide a set of Ruby gems for creating and managing objects in the Fedora Repository Architecture (http://fedora-commons.org).
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            == FEATURES/PROBLEMS:
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            == SYNOPSIS:
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              See usage documentation on the wiki: http://projects.mediashelf.us/wiki/active-fedora/Documentation
         
     | 
| 
      
 12 
     | 
    
         
            +
            h2. Installation
         
     | 
| 
       23 
13 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 14 
     | 
    
         
            +
            The gem is hosted on gemcutter.
         
     | 
| 
       25 
15 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
            <pre>gem install active-fedora</pre>
         
     | 
| 
       27 
17 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
            h2. Getting Started
         
     | 
| 
       29 
19 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
            The "ActiveFedora Console Tour":http://projects.mediashelf.us/wiki/active-fedora/Getting_Started gives you a brief tour through ActiveFedora's features on the command line.
         
     | 
| 
       31 
21 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
            h2. LICENSE:
         
     | 
| 
       33 
23 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
            Copyright (c) 2009 Matt Zumwalt
         
     | 
| 
      
 24 
     | 
    
         
            +
            Copyright (c) 2009-2010 Matt Zumwalt
         
     | 
| 
       35 
25 
     | 
    
         | 
| 
       36 
26 
     | 
    
         
             
            This program is free software: you can redistribute it and/or modify
         
     | 
| 
       37 
27 
     | 
    
         
             
            it under the terms of the GNU Lesser General Public License (LGPL) as 
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -14,6 +14,8 @@ begin 
     | 
|
| 
       14 
14 
     | 
    
         
             
                gem.email = "matt.zumwalt@yourmediashelf.com"
         
     | 
| 
       15 
15 
     | 
    
         
             
                gem.homepage = "http://yourmediashelf.com/activefedora"
         
     | 
| 
       16 
16 
     | 
    
         
             
                gem.authors = ["Matt Zumwalt", "McClain Looney"]
         
     | 
| 
      
 17 
     | 
    
         
            +
                gem.rubyforge_project = 'rubyfedora'
         
     | 
| 
      
 18 
     | 
    
         
            +
                
         
     | 
| 
       17 
19 
     | 
    
         
             
                gem.add_dependency('solr-ruby', '>= 0.0.6')
         
     | 
| 
       18 
20 
     | 
    
         
             
                gem.add_dependency('xml-simple', '>= 1.0.12')
         
     | 
| 
       19 
21 
     | 
    
         
             
                gem.add_dependency('mime-types', '>= 1.16')
         
     | 
| 
         @@ -26,6 +28,7 @@ begin 
     | 
|
| 
       26 
28 
     | 
    
         
             
                # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
         
     | 
| 
       27 
29 
     | 
    
         
             
              end
         
     | 
| 
       28 
30 
     | 
    
         
             
              Jeweler::GemcutterTasks.new
         
     | 
| 
      
 31 
     | 
    
         
            +
              # Jeweler::RubyforgeTasks.new 
         
     | 
| 
       29 
32 
     | 
    
         
             
            rescue LoadError
         
     | 
| 
       30 
33 
     | 
    
         
             
              puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
         
     | 
| 
       31 
34 
     | 
    
         
             
            end
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            0.1.4.pre1
         
     | 
    
        data/active-fedora.gemspec
    CHANGED
    
    | 
         @@ -5,17 +5,17 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{active-fedora}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "1.1. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "1.1.4.pre2"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              s.required_rubygems_version = Gem::Requirement.new(" 
     | 
| 
      
 10 
     | 
    
         
            +
              s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Matt Zumwalt", "McClain Looney"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2010- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-05-15}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{matt.zumwalt@yourmediashelf.com}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
       16 
16 
     | 
    
         
             
                "LICENSE",
         
     | 
| 
       17 
17 
     | 
    
         
             
                 "README.rdoc",
         
     | 
| 
       18 
     | 
    
         
            -
                 "README. 
     | 
| 
      
 18 
     | 
    
         
            +
                 "README.textile"
         
     | 
| 
       19 
19 
     | 
    
         
             
              ]
         
     | 
| 
       20 
20 
     | 
    
         
             
              s.files = [
         
     | 
| 
       21 
21 
     | 
    
         
             
                ".document",
         
     | 
| 
         @@ -176,7 +176,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       176 
176 
     | 
    
         
             
                 "Manifest.txt",
         
     | 
| 
       177 
177 
     | 
    
         
             
                 "PostInstall.txt",
         
     | 
| 
       178 
178 
     | 
    
         
             
                 "README.rdoc",
         
     | 
| 
       179 
     | 
    
         
            -
                 "README. 
     | 
| 
      
 179 
     | 
    
         
            +
                 "README.textile",
         
     | 
| 
       180 
180 
     | 
    
         
             
                 "Rakefile",
         
     | 
| 
       181 
181 
     | 
    
         
             
                 "VERSION",
         
     | 
| 
       182 
182 
     | 
    
         
             
                 "active-fedora.gemspec",
         
     | 
| 
         @@ -217,6 +217,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       217 
217 
     | 
    
         
             
                 "spec/fixtures/changeme155.xml",
         
     | 
| 
       218 
218 
     | 
    
         
             
                 "spec/fixtures/dino.jpg",
         
     | 
| 
       219 
219 
     | 
    
         
             
                 "spec/fixtures/minivan.jpg",
         
     | 
| 
      
 220 
     | 
    
         
            +
                 "spec/fixtures/oh_qdc.xml",
         
     | 
| 
       220 
221 
     | 
    
         
             
                 "spec/fixtures/test_12.foxml.xml",
         
     | 
| 
       221 
222 
     | 
    
         
             
                 "spec/integration/base_file_management_spec.rb",
         
     | 
| 
       222 
223 
     | 
    
         
             
                 "spec/integration/base_loader_spec.rb",
         
     | 
| 
         @@ -237,7 +238,6 @@ Gem::Specification.new do |s| 
     | 
|
| 
       237 
238 
     | 
    
         
             
                 "spec/samples/models/oral_history.rb",
         
     | 
| 
       238 
239 
     | 
    
         
             
                 "spec/samples/models/seminar.rb",
         
     | 
| 
       239 
240 
     | 
    
         
             
                 "spec/samples/models/seminar_audio_file.rb",
         
     | 
| 
       240 
     | 
    
         
            -
                 "spec/samples/oh_qdc.xml",
         
     | 
| 
       241 
241 
     | 
    
         
             
                 "spec/samples/oral_history_sample.xml",
         
     | 
| 
       242 
242 
     | 
    
         
             
                 "spec/samples/oral_history_sample_model.rb",
         
     | 
| 
       243 
243 
     | 
    
         
             
                 "spec/samples/oral_history_xml.xml",
         
     | 
| 
         @@ -273,6 +273,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       273 
273 
     | 
    
         
             
              s.homepage = %q{http://yourmediashelf.com/activefedora}
         
     | 
| 
       274 
274 
     | 
    
         
             
              s.rdoc_options = ["--charset=UTF-8"]
         
     | 
| 
       275 
275 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
      
 276 
     | 
    
         
            +
              s.rubyforge_project = %q{rubyfedora}
         
     | 
| 
       276 
277 
     | 
    
         
             
              s.rubygems_version = %q{1.3.6}
         
     | 
| 
       277 
278 
     | 
    
         
             
              s.summary = %q{A convenience libary for manipulating MODS (Metadata Object Description Schema) documents.}
         
     | 
| 
       278 
279 
     | 
    
         
             
              s.test_files = [
         
     | 
| 
         @@ -311,6 +312,8 @@ Gem::Specification.new do |s| 
     | 
|
| 
       311 
312 
     | 
    
         
             
                 "spec/unit/inheritance_spec.rb",
         
     | 
| 
       312 
313 
     | 
    
         
             
                 "spec/unit/metadata_datastream_spec.rb",
         
     | 
| 
       313 
314 
     | 
    
         
             
                 "spec/unit/model_spec.rb",
         
     | 
| 
      
 315 
     | 
    
         
            +
                 "spec/unit/mods_datastream_spec.rb",
         
     | 
| 
      
 316 
     | 
    
         
            +
                 "spec/unit/nokogiri_datastream_spec.rb",
         
     | 
| 
       314 
317 
     | 
    
         
             
                 "spec/unit/property_spec.rb",
         
     | 
| 
       315 
318 
     | 
    
         
             
                 "spec/unit/qualified_dublin_core_datastream_spec.rb",
         
     | 
| 
       316 
319 
     | 
    
         
             
                 "spec/unit/relationship_spec.rb",
         
     | 
    
        data/lib/active_fedora.rb
    CHANGED
    
    | 
         @@ -40,7 +40,8 @@ module ActiveFedora #:nodoc: 
     | 
|
| 
       40 
40 
     | 
    
         
             
                  if defined?(RAILS_ROOT)
         
     | 
| 
       41 
41 
     | 
    
         
             
                    config_path = "#{RAILS_ROOT}/config/fedora.yml"
         
     | 
| 
       42 
42 
     | 
    
         
             
                  else
         
     | 
| 
       43 
     | 
    
         
            -
                     
     | 
| 
      
 43 
     | 
    
         
            +
                    config_path = File.join(File.dirname(__FILE__), "..", "config", "fedora.yml")
         
     | 
| 
      
 44 
     | 
    
         
            +
                    logger.info "Using the default fedora.yml that comes with active-fedora.  If you want to override this, pass the path to fedora.yml as an argument to ActiveFedora.init or set RAILS_ROOT and put fedora.yml into \#{RAILS_ROOT}/config."
         
     | 
| 
       44 
45 
     | 
    
         
             
                  end
         
     | 
| 
       45 
46 
     | 
    
         
             
                end
         
     | 
| 
       46 
47 
     | 
    
         | 
    
        data/lib/active_fedora/base.rb
    CHANGED
    
    | 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'util/class_level_inheritable_attributes'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'active_fedora/model'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'active_fedora/semantic_node'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'nokogiri'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            SOLR_DOCUMENT_ID = "id" unless defined?(SOLR_DOCUMENT_ID)
         
     | 
| 
       6 
7 
     | 
    
         
             
            ENABLE_SOLR_UPDATES = true unless defined?(ENABLE_SOLR_UPDATES)
         
     | 
| 
         @@ -328,18 +329,33 @@ module ActiveFedora 
     | 
|
| 
       328 
329 
     | 
    
         | 
| 
       329 
330 
     | 
    
         | 
| 
       330 
331 
     | 
    
         
             
                def self.deserialize(doc) #:nodoc:
         
     | 
| 
       331 
     | 
    
         
            -
                   
     | 
| 
      
 332 
     | 
    
         
            +
                  if doc.instance_of?(REXML::Document)
         
     | 
| 
      
 333 
     | 
    
         
            +
                    pid = doc.elements['/foxml:digitalObject'].attributes['PID']
         
     | 
| 
       332 
334 
     | 
    
         | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
     | 
    
         
            -
             
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
       338 
     | 
    
         
            -
             
     | 
| 
      
 335 
     | 
    
         
            +
                    proto = self.new(:pid=>pid, :new_object=>false)
         
     | 
| 
      
 336 
     | 
    
         
            +
                    proto.datastreams.each do |name,ds|
         
     | 
| 
      
 337 
     | 
    
         
            +
                      doc.elements.each("//foxml:datastream[@ID='#{name}']") do |el|
         
     | 
| 
      
 338 
     | 
    
         
            +
                        # datastreams remain marked as new if the foxml doesn't have an entry for that datastream
         
     | 
| 
      
 339 
     | 
    
         
            +
                        ds.new_object = false
         
     | 
| 
      
 340 
     | 
    
         
            +
                        proto.datastreams[name]=ds.class.from_xml(ds, el)          
         
     | 
| 
      
 341 
     | 
    
         
            +
                      end
         
     | 
| 
      
 342 
     | 
    
         
            +
                    end
         
     | 
| 
      
 343 
     | 
    
         
            +
                    proto.inner_object.new_object = false
         
     | 
| 
      
 344 
     | 
    
         
            +
                    return proto
         
     | 
| 
      
 345 
     | 
    
         
            +
                  elsif doc.instance_of?(Nokogiri::XML::Document)
         
     | 
| 
      
 346 
     | 
    
         
            +
                    pid = doc.xpath('/foxml:digitalObject').first["PID"]
         
     | 
| 
      
 347 
     | 
    
         
            +
                  
         
     | 
| 
      
 348 
     | 
    
         
            +
                    proto = self.new(:pid=>pid, :new_object=>false)
         
     | 
| 
      
 349 
     | 
    
         
            +
                    proto.datastreams.each do |name,ds|
         
     | 
| 
      
 350 
     | 
    
         
            +
                      doc.xpath("//foxml:datastream[@ID='#{name}']").each do |node|
         
     | 
| 
      
 351 
     | 
    
         
            +
                        # datastreams remain marked as new if the foxml doesn't have an entry for that datastream
         
     | 
| 
      
 352 
     | 
    
         
            +
                        ds.new_object = false
         
     | 
| 
      
 353 
     | 
    
         
            +
                        proto.datastreams[name]=ds.class.from_xml(ds, node)          
         
     | 
| 
      
 354 
     | 
    
         
            +
                      end
         
     | 
| 
       339 
355 
     | 
    
         
             
                    end
         
     | 
| 
      
 356 
     | 
    
         
            +
                    proto.inner_object.new_object = false
         
     | 
| 
      
 357 
     | 
    
         
            +
                    return proto
         
     | 
| 
       340 
358 
     | 
    
         
             
                  end
         
     | 
| 
       341 
     | 
    
         
            -
                  proto.inner_object.new_object = false
         
     | 
| 
       342 
     | 
    
         
            -
                  return proto
         
     | 
| 
       343 
359 
     | 
    
         
             
                end
         
     | 
| 
       344 
360 
     | 
    
         | 
| 
       345 
361 
     | 
    
         
             
                #Return a hash of all available metadata fields for all 
         
     | 
| 
         @@ -18,5 +18,57 @@ module ActiveFedora 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  return "#{namespace}:#{sanitized_class_name}#{pid_suffix}" 
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
                def self.models_asserted_by(obj)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  Array obj.relationships[:self][:has_model]
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
                
         
     | 
| 
      
 25 
     | 
    
         
            +
                def self.known_models_for(obj)
         
     | 
| 
      
 26 
     | 
    
         
            +
                  models_array = []
         
     | 
| 
      
 27 
     | 
    
         
            +
                  models_asserted_by( obj ).each do |model_uri|
         
     | 
| 
      
 28 
     | 
    
         
            +
                    m = uri_to_model_class(model_uri)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    if m
         
     | 
| 
      
 30 
     | 
    
         
            +
                      models_array << m
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                  
         
     | 
| 
      
 34 
     | 
    
         
            +
                  if models_array.empty?
         
     | 
| 
      
 35 
     | 
    
         
            +
                    models_array = [ActiveFedora::Base]
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                  
         
     | 
| 
      
 38 
     | 
    
         
            +
                  return models_array
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
                
         
     | 
| 
      
 41 
     | 
    
         
            +
                # Returns a ruby class corresponding to the given uri if one can be found.
         
     | 
| 
      
 42 
     | 
    
         
            +
                # Returns false if no corresponding class can be found.
         
     | 
| 
      
 43 
     | 
    
         
            +
                def self.uri_to_ruby_class( uri )
         
     | 
| 
      
 44 
     | 
    
         
            +
                  classname  = uri.gsub("info:fedora/afmodel:", "")
         
     | 
| 
      
 45 
     | 
    
         
            +
                  
         
     | 
| 
      
 46 
     | 
    
         
            +
                  if class_exists?(classname)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    Kernel.const_get(classname)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  else
         
     | 
| 
      
 49 
     | 
    
         
            +
                    false
         
     | 
| 
      
 50 
     | 
    
         
            +
                  end
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
                
         
     | 
| 
      
 53 
     | 
    
         
            +
                # Returns an ActiveFedora Model class corresponding to the given uri if one can be found.
         
     | 
| 
      
 54 
     | 
    
         
            +
                # Returns false if no corresponding model can be found.
         
     | 
| 
      
 55 
     | 
    
         
            +
                def self.uri_to_model_class( uri )
         
     | 
| 
      
 56 
     | 
    
         
            +
                  rc = uri_to_ruby_class(uri)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  if rc && rc.superclass == ActiveFedora::Base
         
     | 
| 
      
 58 
     | 
    
         
            +
                    rc
         
     | 
| 
      
 59 
     | 
    
         
            +
                  else
         
     | 
| 
      
 60 
     | 
    
         
            +
                    false
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
                
         
     | 
| 
      
 64 
     | 
    
         
            +
                private 
         
     | 
| 
      
 65 
     | 
    
         
            +
                
         
     | 
| 
      
 66 
     | 
    
         
            +
                def self.class_exists?(class_name)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  klass = Module.const_get(class_name)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  return klass.is_a?(Class)
         
     | 
| 
      
 69 
     | 
    
         
            +
                rescue NameError
         
     | 
| 
      
 70 
     | 
    
         
            +
                  return false
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
                
         
     | 
| 
       21 
73 
     | 
    
         
             
              end
         
     | 
| 
       22 
74 
     | 
    
         
             
            end
         
     | 
| 
         @@ -70,12 +70,15 @@ module ActiveFedora 
     | 
|
| 
       70 
70 
     | 
    
         
             
                def before_save # :nodoc:
         
     | 
| 
       71 
71 
     | 
    
         
             
                  #check_concurrency
         
     | 
| 
       72 
72 
     | 
    
         
             
                end
         
     | 
| 
       73 
     | 
    
         
            -
                 
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
                
         
     | 
| 
      
 74 
     | 
    
         
            +
                # @tmpl ActiveFedora::Datastream
         
     | 
| 
      
 75 
     | 
    
         
            +
                # @node Nokogiri::XML::Node
         
     | 
| 
      
 76 
     | 
    
         
            +
                def self.from_xml(tmpl, node)
         
     | 
| 
      
 77 
     | 
    
         
            +
                  node.xpath("foxml:xmlContent/fields").each do |f|
         
     | 
| 
      
 78 
     | 
    
         
            +
                    # tmpl.send("#{f.name}_append", f.content)
         
     | 
| 
       76 
79 
     | 
    
         
             
                  end
         
     | 
| 
       77 
80 
     | 
    
         
             
                  tmpl.instance_variable_set(:@dirty, false)
         
     | 
| 
       78 
     | 
    
         
            -
                  tmpl.control_group=  
     | 
| 
      
 81 
     | 
    
         
            +
                  tmpl.control_group= node['CONTROL_GROUP']
         
     | 
| 
       79 
82 
     | 
    
         
             
                  tmpl
         
     | 
| 
       80 
83 
     | 
    
         
             
                end
         
     | 
| 
       81 
84 
     | 
    
         | 
| 
         @@ -53,9 +53,12 @@ module ActiveFedora 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  end
         
     | 
| 
       54 
54 
     | 
    
         
             
                  return xml.to_s
         
     | 
| 
       55 
55 
     | 
    
         
             
                end
         
     | 
| 
       56 
     | 
    
         
            -
                 
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                
         
     | 
| 
      
 57 
     | 
    
         
            +
                # @tmpl ActiveFedora::MetadataDatastream
         
     | 
| 
      
 58 
     | 
    
         
            +
                # @node Nokogiri::XML::Node
         
     | 
| 
      
 59 
     | 
    
         
            +
                def self.from_xml(tmpl, node) # :nodoc:
         
     | 
| 
      
 60 
     | 
    
         
            +
                  node.xpath("./foxml:datastreamVersion[last()]/foxml:xmlContent/fields/node()").each do |f|
         
     | 
| 
      
 61 
     | 
    
         
            +
                      tmpl.send("#{f.name}_append", f.text) unless f.class == Nokogiri::XML::Text
         
     | 
| 
       59 
62 
     | 
    
         
             
                  end
         
     | 
| 
       60 
63 
     | 
    
         
             
                  tmpl.send(:dirty=, false)
         
     | 
| 
       61 
64 
     | 
    
         
             
                  tmpl
         
     | 
| 
         @@ -26,21 +26,23 @@ module ActiveFedora 
     | 
|
| 
       26 
26 
     | 
    
         
             
                  self.blob = self.to_dc_xml
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
                # @tmpl ActiveFedora::Datastream
         
     | 
| 
      
 30 
     | 
    
         
            +
                # @node Nokogiri::XML::Node
         
     | 
| 
      
 31 
     | 
    
         
            +
                def self.from_xml(tmpl, node) # :nodoc:
         
     | 
| 
       30 
32 
     | 
    
         
             
                 tmpl.fields.each do |z|
         
     | 
| 
       31 
33 
     | 
    
         
             
                   fname = z.first
         
     | 
| 
       32 
34 
     | 
    
         
             
                   fspec = z.last
         
     | 
| 
       33 
     | 
    
         
            -
                    
     | 
| 
      
 35 
     | 
    
         
            +
                   node_name = "dcterms:#{fspec[:xml_node] ? fspec[:xml_node] : fname}"
         
     | 
| 
       34 
36 
     | 
    
         
             
                   attr_modifier= "[@xsi:type='#{fspec[:encoding]}']" if fspec[:encoding]
         
     | 
| 
       35 
     | 
    
         
            -
                   query = "./foxml:datastreamVersion[last()]/foxml:xmlContent/dc/#{ 
     | 
| 
       36 
     | 
    
         
            -
                    
     | 
| 
      
 37 
     | 
    
         
            +
                   query = "./foxml:datastreamVersion[last()]/foxml:xmlContent/dc/#{node_name}#{attr_modifier}"
         
     | 
| 
      
 38 
     | 
    
         
            +
                   node.xpath(query, {"foxml"=>"info:fedora/fedora-system:def/foxml#", "dcterms"=>'http://purl.org/dc/terms/', "xsi"=>'http://www.w3.org/2001/XMLSchema-instance'}).each do |f|
         
     | 
| 
       37 
39 
     | 
    
         
             
                      tmpl.send("#{fname}_append", f.text)
         
     | 
| 
       38 
40 
     | 
    
         
             
                    end
         
     | 
| 
       39 
41 
     | 
    
         | 
| 
       40 
42 
     | 
    
         
             
                 end
         
     | 
| 
       41 
43 
     | 
    
         
             
                 tmpl.instance_variable_set(:@dirty, false)
         
     | 
| 
       42 
44 
     | 
    
         
             
                 tmpl
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
       44 
46 
     | 
    
         | 
| 
       45 
47 
     | 
    
         
             
               #Render self as a Fedora DC xml document.
         
     | 
| 
       46 
48 
     | 
    
         
             
               def to_dc_xml
         
     | 
| 
         @@ -28,12 +28,13 @@ module ActiveFedora 
     | 
|
| 
       28 
28 
     | 
    
         
             
                  EOL
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                #  
     | 
| 
       32 
     | 
    
         
            -
                 
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                   
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                      r = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>ActiveFedora::SemanticNode::PREDICATE_MAPPINGS.invert[f.name], :object=>f 
     | 
| 
      
 31 
     | 
    
         
            +
                # @tmpl ActiveFedora::MetadataDatastream
         
     | 
| 
      
 32 
     | 
    
         
            +
                # @node Nokogiri::XML::Node
         
     | 
| 
      
 33 
     | 
    
         
            +
                def self.from_xml(tmpl, node) 
         
     | 
| 
      
 34 
     | 
    
         
            +
                  # node.xpath("./foxml:datastreamVersion[last()]/foxml:xmlContent/rdf:RDF/rdf:Description/*").each do |f|
         
     | 
| 
      
 35 
     | 
    
         
            +
                  node.xpath("./foxml:datastreamVersion[last()]/foxml:xmlContent/rdf:RDF/rdf:Description/*", {"rdf"=>"http://www.w3.org/1999/02/22-rdf-syntax-ns#", "foxml"=>"info:fedora/fedora-system:def/foxml#"}).each do |f|
         
     | 
| 
      
 36 
     | 
    
         
            +
                      r = ActiveFedora::Relationship.new(:subject=>:self, :predicate=>ActiveFedora::SemanticNode::PREDICATE_MAPPINGS.invert[f.name], :object=>f["resource"])
         
     | 
| 
      
 37 
     | 
    
         
            +
                      puts "adding #{r.inspect} to template"
         
     | 
| 
       37 
38 
     | 
    
         
             
                      tmpl.add_relationship(r)
         
     | 
| 
       38 
39 
     | 
    
         
             
                  end
         
     | 
| 
       39 
40 
     | 
    
         
             
                  tmpl.send(:dirty=, false)
         
     | 
    
        data/lib/fedora/repository.rb
    CHANGED
    
    | 
         @@ -4,6 +4,7 @@ require 'fedora/connection' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'fedora/formats'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'fedora/fedora_object'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'fedora/datastream'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require "nokogiri"
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
            module Fedora
         
     | 
| 
       9 
10 
     | 
    
         
             
              NAMESPACE = "fedora:info/"
         
     | 
| 
         @@ -96,9 +97,11 @@ module Fedora 
     | 
|
| 
       96 
97 
     | 
    
         | 
| 
       97 
98 
     | 
    
         
             
                  convert_xml(connection.get("#{fedora_url.path}/objects?#{params.to_fedora_query}#{includes}"))
         
     | 
| 
       98 
99 
     | 
    
         
             
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
                
         
     | 
| 
       99 
101 
     | 
    
         
             
                def find_model(pid, klazz)
         
     | 
| 
       100 
102 
     | 
    
         
             
                  obj = self.find_objects("pid=#{pid}").first
         
     | 
| 
       101 
     | 
    
         
            -
                  doc = REXML::Document.new(obj.object_xml, :ignore_whitespace_nodes=>:all)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  #doc = REXML::Document.new(obj.object_xml, :ignore_whitespace_nodes=>:all)
         
     | 
| 
      
 104 
     | 
    
         
            +
                  doc = Nokogiri::XML::Document.parse(obj.object_xml)     
         
     | 
| 
       102 
105 
     | 
    
         
             
                  klazz.deserialize(doc)
         
     | 
| 
       103 
106 
     | 
    
         
             
                end
         
     | 
| 
       104 
107 
     | 
    
         | 
| 
         
            File without changes
         
     | 
| 
         @@ -3,6 +3,7 @@ require 'active_fedora' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'active_fedora/base'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'active_fedora/metadata_datastream'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'ruby-debug'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'nokogiri'
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            # Load Sample OralHistory Model
         
     | 
| 
       8 
9 
     | 
    
         
             
            require File.join( File.dirname(__FILE__), "..","samples","oral_history_sample_model" )
         
     | 
| 
         @@ -28,7 +29,7 @@ describe ActiveFedora::Base do 
     | 
|
| 
       28 
29 
     | 
    
         
             
                  #mocko = mock("object")
         
     | 
| 
       29 
30 
     | 
    
         
             
                  #ActiveFedora::Base.expects(:new).returns(mocko)
         
     | 
| 
       30 
31 
     | 
    
         
             
                  @test_object.datastreams["sensitive_passages"].delete
         
     | 
| 
       31 
     | 
    
         
            -
                  doc =  
     | 
| 
      
 32 
     | 
    
         
            +
                  doc = Nokogiri::XML::Document.parse(@test_object.inner_object.object_xml)
         
     | 
| 
       32 
33 
     | 
    
         
             
                  result = OralHistorySampleModel.deserialize(doc)
         
     | 
| 
       33 
34 
     | 
    
         
             
                  result.new_object?.should be_false
         
     | 
| 
       34 
35 
     | 
    
         
             
                  result.datastreams_in_memory.should have_key("dublin_core")
         
     | 
| 
         @@ -6,6 +6,11 @@ require 'mocha' 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            describe ActiveFedora::ContentModel do
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
              before(:all) do
         
     | 
| 
      
 10 
     | 
    
         
            +
                class SampleModel < ActiveFedora::Base
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
       9 
14 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       10 
15 
     | 
    
         
             
                Fedora::Repository.instance.stubs(:nextid).returns("_nextid_")
         
     | 
| 
       11 
16 
     | 
    
         
             
                @test_cmodel = ActiveFedora::ContentModel.new
         
     | 
| 
         @@ -47,5 +52,51 @@ describe ActiveFedora::ContentModel do 
     | 
|
| 
       47 
52 
     | 
    
         
             
                end
         
     | 
| 
       48 
53 
     | 
    
         
             
              end
         
     | 
| 
       49 
54 
     | 
    
         | 
| 
      
 55 
     | 
    
         
            +
              describe "models_asserted_by" do
         
     | 
| 
      
 56 
     | 
    
         
            +
                it "should return an array of all of the content models asserted by the given object" do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  mock_object = mock("ActiveFedora Object")
         
     | 
| 
      
 58 
     | 
    
         
            +
                  mock_object.expects(:relationships).returns( :self=>{:has_model=>["info:fedora/fedora-system:ServiceDefinition-3.0", "info:fedora/afmodel:SampleModel", "info:fedora/afmodel:NonDefinedModel"]} )
         
     | 
| 
      
 59 
     | 
    
         
            +
                  ActiveFedora::ContentModel.models_asserted_by(mock_object).should == ["info:fedora/fedora-system:ServiceDefinition-3.0", "info:fedora/afmodel:SampleModel", "info:fedora/afmodel:NonDefinedModel"]
         
     | 
| 
      
 60 
     | 
    
         
            +
                end
         
     | 
| 
      
 61 
     | 
    
         
            +
                it "should return an empty array if the object doesn't have a RELS-EXT datastream" do
         
     | 
| 
      
 62 
     | 
    
         
            +
                  mock_object = mock("ActiveFedora Object")
         
     | 
| 
      
 63 
     | 
    
         
            +
                  mock_object.expects(:relationships).returns( :self=>{} )
         
     | 
| 
      
 64 
     | 
    
         
            +
                  ActiveFedora::ContentModel.models_asserted_by(mock_object).should == []
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
              
         
     | 
| 
      
 68 
     | 
    
         
            +
              describe "known_models_asserted_by" do
         
     | 
| 
      
 69 
     | 
    
         
            +
                it "should figure out the applicable models to load" do
         
     | 
| 
      
 70 
     | 
    
         
            +
                  mock_object = mock("ActiveFedora Object")
         
     | 
| 
      
 71 
     | 
    
         
            +
                  mock_object.expects(:relationships).returns( :self=>{:has_model=>["info:fedora/fedora-system:ServiceDefinition-3.0", "info:fedora/afmodel:SampleModel", "info:fedora/afmodel:NonDefinedModel"]} )
         
     | 
| 
      
 72 
     | 
    
         
            +
                  ActiveFedora::ContentModel.known_models_for(mock_object).should == [SampleModel]
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
      
 74 
     | 
    
         
            +
                it "should default to using ActiveFedora::Base as the model" do
         
     | 
| 
      
 75 
     | 
    
         
            +
                  mock_object = mock("ActiveFedora Object")
         
     | 
| 
      
 76 
     | 
    
         
            +
                  mock_object.expects(:relationships).returns( :self=>{:has_model=>["info:fedora/afmodel:NonDefinedModel"]} )
         
     | 
| 
      
 77 
     | 
    
         
            +
                  ActiveFedora::ContentModel.known_models_for(mock_object).should == [ActiveFedora::Base]
         
     | 
| 
      
 78 
     | 
    
         
            +
                end
         
     | 
| 
      
 79 
     | 
    
         
            +
                it "should still work even if the object doesn't have a RELS-EXT datastream" do
         
     | 
| 
      
 80 
     | 
    
         
            +
                  mock_object = mock("ActiveFedora Object")
         
     | 
| 
      
 81 
     | 
    
         
            +
                  mock_object.expects(:relationships).returns( :self=>{} )
         
     | 
| 
      
 82 
     | 
    
         
            +
                  ActiveFedora::ContentModel.known_models_for(mock_object).should == [ActiveFedora::Base]
         
     | 
| 
      
 83 
     | 
    
         
            +
                end
         
     | 
| 
      
 84 
     | 
    
         
            +
              end
         
     | 
| 
      
 85 
     | 
    
         
            +
              
         
     | 
| 
      
 86 
     | 
    
         
            +
              describe "uri_to_ruby_class" do
         
     | 
| 
      
 87 
     | 
    
         
            +
                it "should return ruby class corresponding to the given uri if a valid class can be found" do
         
     | 
| 
      
 88 
     | 
    
         
            +
                  ActiveFedora::ContentModel.uri_to_ruby_class("info:fedora/afmodel:SampleModel").should == SampleModel
         
     | 
| 
      
 89 
     | 
    
         
            +
                  ActiveFedora::ContentModel.uri_to_ruby_class("info:fedora/afmodel:NonDefinedModel").should == false
         
     | 
| 
      
 90 
     | 
    
         
            +
                  ActiveFedora::ContentModel.uri_to_ruby_class("info:fedora/afmodel:String").should == String
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
              
         
     | 
| 
      
 94 
     | 
    
         
            +
              describe "uri_to_model_class" do
         
     | 
| 
      
 95 
     | 
    
         
            +
                it "should return an ActiveFedora Model class corresponding to the given uri if a valid model can be found" do
         
     | 
| 
      
 96 
     | 
    
         
            +
                  ActiveFedora::ContentModel.uri_to_model_class("info:fedora/afmodel:SampleModel").should == SampleModel
         
     | 
| 
      
 97 
     | 
    
         
            +
                  ActiveFedora::ContentModel.uri_to_model_class("info:fedora/afmodel:NonDefinedModel").should == false
         
     | 
| 
      
 98 
     | 
    
         
            +
                  ActiveFedora::ContentModel.uri_to_model_class("info:fedora/afmodel:String").should == false
         
     | 
| 
      
 99 
     | 
    
         
            +
                end
         
     | 
| 
      
 100 
     | 
    
         
            +
              end
         
     | 
| 
       50 
101 
     | 
    
         | 
| 
       51 
102 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require File.join( File.dirname(__FILE__), "../spec_helper" )
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_fedora'
         
     | 
| 
       4 
     | 
    
         
            -
            require " 
     | 
| 
      
 4 
     | 
    
         
            +
            require "nokogiri"
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'ftools'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            describe ActiveFedora::Datastream do
         
     | 
| 
         @@ -27,7 +27,7 @@ describe ActiveFedora::Datastream do 
     | 
|
| 
       27 
27 
     | 
    
         
             
                    </foxml:datastreamVersion>
         
     | 
| 
       28 
28 
     | 
    
         
             
                  </foxml:datastream>
         
     | 
| 
       29 
29 
     | 
    
         
             
                EOF
         
     | 
| 
       30 
     | 
    
         
            -
                n = ActiveFedora::Datastream.from_xml(ActiveFedora::Datastream.new,  
     | 
| 
      
 30 
     | 
    
         
            +
                n = ActiveFedora::Datastream.from_xml(ActiveFedora::Datastream.new, Nokogiri::XML::Document.parse(xml).root)
         
     | 
| 
       31 
31 
     | 
    
         
             
                n.control_group.should == 'M'
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
         @@ -0,0 +1,289 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.join( File.dirname(__FILE__), "../spec_helper" )
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'active_fedora'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'hydra'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            describe ModsDatastream do
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              before(:all) do
         
     | 
| 
      
 9 
     | 
    
         
            +
                @sample_fields = {:publisher => {:values => ["publisher1"], :type => :string}, 
         
     | 
| 
      
 10 
     | 
    
         
            +
                                  :coverage => {:values => ["coverage1", "coverage2"], :type => :text}, 
         
     | 
| 
      
 11 
     | 
    
         
            +
                                  :creation_date => {:values => "fake-date", :type => :date},
         
     | 
| 
      
 12 
     | 
    
         
            +
                                  :mydate => {:values => "fake-date", :type => :date},
         
     | 
| 
      
 13 
     | 
    
         
            +
                                  :empty_field => {:values => {}}
         
     | 
| 
      
 14 
     | 
    
         
            +
                                  } 
         
     | 
| 
      
 15 
     | 
    
         
            +
                @sample_xml = XmlSimple.xml_in("<fields><coverage>coverage1</coverage><coverage>coverage2</coverage><creation_date>fake-date</creation_date><mydate>fake-date</mydate><publisher>publisher1</publisher></fields>")
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 20 
     | 
    
         
            +
                @test_ds = ModsDatastream.new
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
              after(:each) do
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              describe '#new' do
         
     | 
| 
      
 27 
     | 
    
         
            +
                it 'should provide #new' do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  ModsDatastream.should respond_to(:new)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @test_ds.ng_xml.should be_instance_of(OpinionatedModsDocument)
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
              
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              it 'should provide .fields' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                @test_ds.should respond_to(:fields)
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
              
         
     | 
| 
      
 38 
     | 
    
         
            +
              describe '.save' do
         
     | 
| 
      
 39 
     | 
    
         
            +
                it "should provide .save" do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @test_ds.should respond_to(:save)
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
                it "should persist the product of .to_xml in fedora" do
         
     | 
| 
      
 43 
     | 
    
         
            +
                  Fedora::Repository.instance.expects(:save)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  @test_ds.expects(:to_xml).returns("fake xml")
         
     | 
| 
      
 45 
     | 
    
         
            +
                  @test_ds.expects(:blob=).with("fake xml")
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @test_ds.save
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
              
         
     | 
| 
      
 50 
     | 
    
         
            +
              describe '.to_xml' do
         
     | 
| 
      
 51 
     | 
    
         
            +
                it "should provide .to_xml" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  @test_ds.should respond_to(:to_xml)
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
                it 'should output the fields hash as XML' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  #sample_rexml = REXML::Document.new(sample_xml)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  #returned_rexml = REXML::Document.new(@test_ds.to_dc_xml)
         
     | 
| 
      
 58 
     | 
    
         
            +
                  #returned_rexml.to_s.should == sample_rexml.to_s
         
     | 
| 
      
 59 
     | 
    
         
            +
                  returned_xml = XmlSimple.xml_in(@test_ds.to_xml)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  returned_xml.should == @sample_xml
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
                
         
     | 
| 
      
 63 
     | 
    
         
            +
                it 'should accept an optional REXML Document as an argument and insert its fields into that' do
         
     | 
| 
      
 64 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  rexml = REXML::Document.new("<test_rexml/>")
         
     | 
| 
      
 66 
     | 
    
         
            +
                  rexml.root.elements.expects(:add).times(5)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  result = @test_ds.to_xml(rexml)
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
      
 69 
     | 
    
         
            +
                it 'should accept an optional REXML Document as an argument and insert its fields into that' do
         
     | 
| 
      
 70 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 71 
     | 
    
         
            +
                  rexml = REXML::Document.new("<test_rexml/>")
         
     | 
| 
      
 72 
     | 
    
         
            +
                  result = @test_ds.to_xml(rexml)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  XmlSimple.xml_in(rexml.to_s).should == @sample_xml
         
     | 
| 
      
 74 
     | 
    
         
            +
                  XmlSimple.xml_in(result).should == @sample_xml
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
                
         
     | 
| 
      
 77 
     | 
    
         
            +
                it 'should add to root of REXML::Documents, but add directly to the elements if a REXML::Element is passed in' do
         
     | 
| 
      
 78 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields).times(2)
         
     | 
| 
      
 79 
     | 
    
         
            +
                  doc = REXML::Document.new("<test_document/>")
         
     | 
| 
      
 80 
     | 
    
         
            +
                  el = REXML::Element.new("<test_element/>")
         
     | 
| 
      
 81 
     | 
    
         
            +
                  doc.root.elements.expects(:add).times(5)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  el.expects(:add).times(5)
         
     | 
| 
      
 83 
     | 
    
         
            +
                  @test_ds.to_xml(doc)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  @test_ds.to_xml(el)
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
                
         
     | 
| 
      
 87 
     | 
    
         
            +
              end
         
     | 
| 
      
 88 
     | 
    
         
            +
              
         
     | 
| 
      
 89 
     | 
    
         
            +
              describe '.set_blob_for_save' do
         
     | 
| 
      
 90 
     | 
    
         
            +
                it "should provide .set_blob_for_save" do
         
     | 
| 
      
 91 
     | 
    
         
            +
                  @test_ds.should respond_to(:set_blob_for_save)
         
     | 
| 
      
 92 
     | 
    
         
            +
                end
         
     | 
| 
      
 93 
     | 
    
         
            +
                
         
     | 
| 
      
 94 
     | 
    
         
            +
                it "should set the blob to to_xml" do
         
     | 
| 
      
 95 
     | 
    
         
            +
                  @test_ds.expects(:blob=).with(@test_ds.to_xml)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  @test_ds.set_blob_for_save
         
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
              end
         
     | 
| 
      
 99 
     | 
    
         
            +
              
         
     | 
| 
      
 100 
     | 
    
         
            +
              describe '#field' do
         
     | 
| 
      
 101 
     | 
    
         
            +
                
         
     | 
| 
      
 102 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 103 
     | 
    
         
            +
                  class SpecDatastream < ActiveFedora::MetadataDatastream
         
     | 
| 
      
 104 
     | 
    
         
            +
                    def initialize
         
     | 
| 
      
 105 
     | 
    
         
            +
                    super
         
     | 
| 
      
 106 
     | 
    
         
            +
                    field :publisher, :string
         
     | 
| 
      
 107 
     | 
    
         
            +
                    field :coverage, :text
         
     | 
| 
      
 108 
     | 
    
         
            +
                    field :creation_date, :date
         
     | 
| 
      
 109 
     | 
    
         
            +
                    field :mydate, :date
         
     | 
| 
      
 110 
     | 
    
         
            +
                    field :mycomplicated_field, :string, :multiple=>false, :encoding=>'LCSH', :element_attrs=>{:foo=>:bar, :baz=>:bat}
         
     | 
| 
      
 111 
     | 
    
         
            +
                    end
         
     | 
| 
      
 112 
     | 
    
         
            +
                  end
         
     | 
| 
      
 113 
     | 
    
         
            +
                end
         
     | 
| 
      
 114 
     | 
    
         
            +
                
         
     | 
| 
      
 115 
     | 
    
         
            +
                after(:each) do
         
     | 
| 
      
 116 
     | 
    
         
            +
                  Object.send(:remove_const, :SpecDatastream)
         
     | 
| 
      
 117 
     | 
    
         
            +
                end
         
     | 
| 
      
 118 
     | 
    
         
            +
                
         
     | 
| 
      
 119 
     | 
    
         
            +
                it 'should add corresponding field to the @fields hash and set the field :type ' do
         
     | 
| 
      
 120 
     | 
    
         
            +
                  sds = SpecDatastream.new
         
     | 
| 
      
 121 
     | 
    
         
            +
                  sds.fields.should_not have_key(:bio)
         
     | 
| 
      
 122 
     | 
    
         
            +
                  sds.field :bio, :text
         
     | 
| 
      
 123 
     | 
    
         
            +
                  sds.fields.should have_key(:bio)
         
     | 
| 
      
 124 
     | 
    
         
            +
                  sds.fields[:bio].should have_key(:type)
         
     | 
| 
      
 125 
     | 
    
         
            +
                  sds.fields[:bio][:type].should == :text
         
     | 
| 
      
 126 
     | 
    
         
            +
                  sds.fields[:mycomplicated_field][:element_attrs].should == {:foo=>:bar, :baz=>:bat}
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
                
         
     | 
| 
      
 129 
     | 
    
         
            +
                # it "should insert custom element attrs into the xml stream" do
         
     | 
| 
      
 130 
     | 
    
         
            +
                #   sds = SpecDatastream.new
         
     | 
| 
      
 131 
     | 
    
         
            +
                #   sds.mycomplicated_field_values='foo'
         
     | 
| 
      
 132 
     | 
    
         
            +
                #   sds.fields[:mycomplicated_field][:element_attrs].should == {:foo=>:bar, :baz=>:bat}
         
     | 
| 
      
 133 
     | 
    
         
            +
                #   sds.to_xml.should == '<fields><mycomplicated_field baz=\'bat\' foo=\'bar\'>foo</mycomplicated_field></fields>'
         
     | 
| 
      
 134 
     | 
    
         
            +
                # end
         
     | 
| 
      
 135 
     | 
    
         
            +
                
         
     | 
| 
      
 136 
     | 
    
         
            +
                it "should add getters and setters and appenders with field name" do
         
     | 
| 
      
 137 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 138 
     | 
    
         
            +
                  local_test_ds.should respond_to(:publisher_values)
         
     | 
| 
      
 139 
     | 
    
         
            +
                  local_test_ds.should respond_to(:publisher_append)
         
     | 
| 
      
 140 
     | 
    
         
            +
                  local_test_ds.should respond_to(:publisher_values=)
         
     | 
| 
      
 141 
     | 
    
         
            +
                  local_test_ds.publisher_values.class.should == Array
         
     | 
| 
      
 142 
     | 
    
         
            +
                  local_test_ds.should respond_to(:coverage_values)
         
     | 
| 
      
 143 
     | 
    
         
            +
                  local_test_ds.should respond_to(:coverage_values=)
         
     | 
| 
      
 144 
     | 
    
         
            +
                  local_test_ds.should respond_to(:coverage_append)
         
     | 
| 
      
 145 
     | 
    
         
            +
                  local_test_ds.should respond_to(:creation_date_values)
         
     | 
| 
      
 146 
     | 
    
         
            +
                  local_test_ds.should respond_to(:creation_date_append)
         
     | 
| 
      
 147 
     | 
    
         
            +
                  local_test_ds.should respond_to(:creation_date_values=)
         
     | 
| 
      
 148 
     | 
    
         
            +
                  local_test_ds.should respond_to(:mydate_values)
         
     | 
| 
      
 149 
     | 
    
         
            +
                  local_test_ds.should respond_to(:mydate_append)
         
     | 
| 
      
 150 
     | 
    
         
            +
                  local_test_ds.should respond_to(:mydate_values=)
         
     | 
| 
      
 151 
     | 
    
         
            +
                end
         
     | 
| 
      
 152 
     | 
    
         
            +
                
         
     | 
| 
      
 153 
     | 
    
         
            +
                it "should track field values at instance level, not at class level" do
         
     | 
| 
      
 154 
     | 
    
         
            +
                  local_test_ds1 = SpecDatastream.new
         
     | 
| 
      
 155 
     | 
    
         
            +
                  local_test_ds2 = SpecDatastream.new
         
     | 
| 
      
 156 
     | 
    
         
            +
                  local_test_ds1.publisher_values = ["publisher1", "publisher2"]
         
     | 
| 
      
 157 
     | 
    
         
            +
                  local_test_ds2.publisher_values = ["publisherA", "publisherB"]
         
     | 
| 
      
 158 
     | 
    
         
            +
                  
         
     | 
| 
      
 159 
     | 
    
         
            +
                  local_test_ds2.publisher_values.should == ["publisherA", "publisherB"]      
         
     | 
| 
      
 160 
     | 
    
         
            +
                  local_test_ds1.publisher_values.should == ["publisher1", "publisher2"]
         
     | 
| 
      
 161 
     | 
    
         
            +
                end
         
     | 
| 
      
 162 
     | 
    
         
            +
                
         
     | 
| 
      
 163 
     | 
    
         
            +
                it "should allow you to add field values using <<" do
         
     | 
| 
      
 164 
     | 
    
         
            +
                  local_test_ds1 = SpecDatastream.new
         
     | 
| 
      
 165 
     | 
    
         
            +
                  local_test_ds1.publisher_values << "publisher1"
         
     | 
| 
      
 166 
     | 
    
         
            +
                  local_test_ds1.publisher_values.should == ["publisher1"] 
         
     | 
| 
      
 167 
     | 
    
         
            +
                end
         
     | 
| 
      
 168 
     | 
    
         
            +
                
         
     | 
| 
      
 169 
     | 
    
         
            +
                it "should create setter that always turns non-arrays into arrays" do
         
     | 
| 
      
 170 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 171 
     | 
    
         
            +
                  local_test_ds.publisher_values = "Foo"
         
     | 
| 
      
 172 
     | 
    
         
            +
                  local_test_ds.publisher_values.should == ["Foo"]
         
     | 
| 
      
 173 
     | 
    
         
            +
                end
         
     | 
| 
      
 174 
     | 
    
         
            +
                
         
     | 
| 
      
 175 
     | 
    
         
            +
                it "should create setter that sets datastream.dirty? to true" do
         
     | 
| 
      
 176 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 177 
     | 
    
         
            +
                  local_test_ds.should_not be_dirty
         
     | 
| 
      
 178 
     | 
    
         
            +
                  local_test_ds.publisher_values = "Foo"
         
     | 
| 
      
 179 
     | 
    
         
            +
                  local_test_ds.should be_dirty
         
     | 
| 
      
 180 
     | 
    
         
            +
                  
         
     | 
| 
      
 181 
     | 
    
         
            +
                  # Note: If you use << to append values, the datastream will not be marked as dirty!
         
     | 
| 
      
 182 
     | 
    
         
            +
                  #local_test_ds.dirty = false
         
     | 
| 
      
 183 
     | 
    
         
            +
                  
         
     | 
| 
      
 184 
     | 
    
         
            +
                  #local_test_ds.should_not be_dirty
         
     | 
| 
      
 185 
     | 
    
         
            +
                  #local_test_ds.publisher_values << "Foo"
         
     | 
| 
      
 186 
     | 
    
         
            +
                  #local_test_ds.should be_dirty      
         
     | 
| 
      
 187 
     | 
    
         
            +
                end
         
     | 
| 
      
 188 
     | 
    
         
            +
                
         
     | 
| 
      
 189 
     | 
    
         
            +
                it "should add any extra opts to the field hash" do
         
     | 
| 
      
 190 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 191 
     | 
    
         
            +
                  local_test_ds.field "myfield", :string, :foo => "foo", :bar => "bar"      
         
     | 
| 
      
 192 
     | 
    
         
            +
                  local_test_ds.fields[:myfield].should have_key(:foo)
         
     | 
| 
      
 193 
     | 
    
         
            +
                  local_test_ds.fields[:myfield][:foo].should == "foo"
         
     | 
| 
      
 194 
     | 
    
         
            +
                  local_test_ds.fields[:myfield].should have_key(:bar)
         
     | 
| 
      
 195 
     | 
    
         
            +
                  local_test_ds.fields[:myfield][:bar].should == "bar"      
         
     | 
| 
      
 196 
     | 
    
         
            +
                end
         
     | 
| 
      
 197 
     | 
    
         
            +
                
         
     | 
| 
      
 198 
     | 
    
         
            +
              end
         
     | 
| 
      
 199 
     | 
    
         
            +
              
         
     | 
| 
      
 200 
     | 
    
         
            +
              describe ".to_solr" do
         
     | 
| 
      
 201 
     | 
    
         
            +
                
         
     | 
| 
      
 202 
     | 
    
         
            +
                after(:all) do
         
     | 
| 
      
 203 
     | 
    
         
            +
                  # Revert to default mappings after running tests
         
     | 
| 
      
 204 
     | 
    
         
            +
                  ActiveFedora::SolrService.load_mappings
         
     | 
| 
      
 205 
     | 
    
         
            +
                end
         
     | 
| 
      
 206 
     | 
    
         
            +
                
         
     | 
| 
      
 207 
     | 
    
         
            +
                it "should provide .to_solr and return a SolrDocument" do
         
     | 
| 
      
 208 
     | 
    
         
            +
                  @test_ds.should respond_to(:to_solr)
         
     | 
| 
      
 209 
     | 
    
         
            +
                  @test_ds.to_solr.should be_kind_of(Solr::Document)
         
     | 
| 
      
 210 
     | 
    
         
            +
                end
         
     | 
| 
      
 211 
     | 
    
         
            +
                
         
     | 
| 
      
 212 
     | 
    
         
            +
                it "should optionally allow you to provide the Solr::Document to add fields to and return that document when done" do
         
     | 
| 
      
 213 
     | 
    
         
            +
                  doc = Solr::Document.new
         
     | 
| 
      
 214 
     | 
    
         
            +
                  @test_ds.to_solr(doc).should equal(doc)
         
     | 
| 
      
 215 
     | 
    
         
            +
                end
         
     | 
| 
      
 216 
     | 
    
         
            +
                
         
     | 
| 
      
 217 
     | 
    
         
            +
                it "should iterate through @fields hash" do
         
     | 
| 
      
 218 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 219 
     | 
    
         
            +
                  solr_doc =  @test_ds.to_solr
         
     | 
| 
      
 220 
     | 
    
         
            +
                  
         
     | 
| 
      
 221 
     | 
    
         
            +
                  solr_doc[:publisher_t].should == "publisher1"
         
     | 
| 
      
 222 
     | 
    
         
            +
                  solr_doc[:coverage_t].should == "coverage1"
         
     | 
| 
      
 223 
     | 
    
         
            +
                  solr_doc[:creation_date_dt].should == "fake-date"
         
     | 
| 
      
 224 
     | 
    
         
            +
                  solr_doc[:mydate_dt].should == "fake-date"
         
     | 
| 
      
 225 
     | 
    
         
            +
                  
         
     | 
| 
      
 226 
     | 
    
         
            +
                  solr_doc[:empty_field_t].should be_nil
         
     | 
| 
      
 227 
     | 
    
         
            +
                end
         
     | 
| 
      
 228 
     | 
    
         
            +
                
         
     | 
| 
      
 229 
     | 
    
         
            +
                it "should allow multiple values for a single field"
         
     | 
| 
      
 230 
     | 
    
         
            +
                
         
     | 
| 
      
 231 
     | 
    
         
            +
                it 'should append create keys in format field_name + _ + field_type' do
         
     | 
| 
      
 232 
     | 
    
         
            +
                  @test_ds.stubs(:fields).returns(@sample_fields)
         
     | 
| 
      
 233 
     | 
    
         
            +
                  
         
     | 
| 
      
 234 
     | 
    
         
            +
                  #should have these
         
     | 
| 
      
 235 
     | 
    
         
            +
                        
         
     | 
| 
      
 236 
     | 
    
         
            +
                  @test_ds.to_solr[:publisher_t].should_not be_nil
         
     | 
| 
      
 237 
     | 
    
         
            +
                  @test_ds.to_solr[:coverage_t].should_not be_nil
         
     | 
| 
      
 238 
     | 
    
         
            +
                  @test_ds.to_solr[:creation_date_dt].should_not be_nil
         
     | 
| 
      
 239 
     | 
    
         
            +
                  
         
     | 
| 
      
 240 
     | 
    
         
            +
                  #should NOT have these
         
     | 
| 
      
 241 
     | 
    
         
            +
                  @test_ds.to_solr[:narrator].should be_nil
         
     | 
| 
      
 242 
     | 
    
         
            +
                  @test_ds.to_solr[:title].should be_nil
         
     | 
| 
      
 243 
     | 
    
         
            +
                  @test_ds.to_solr[:empty_field].should be_nil
         
     | 
| 
      
 244 
     | 
    
         
            +
                  
         
     | 
| 
      
 245 
     | 
    
         
            +
                end
         
     | 
| 
      
 246 
     | 
    
         
            +
                
         
     | 
| 
      
 247 
     | 
    
         
            +
                it "should use Solr mappings to generate field names" do
         
     | 
| 
      
 248 
     | 
    
         
            +
                  ActiveFedora::SolrService.load_mappings(File.join(File.dirname(__FILE__), "..", "..", "config", "solr_mappings_af_0.1.yml"))
         
     | 
| 
      
 249 
     | 
    
         
            +
                  @test_ds.stubs(:fields).returns(@sample_fields)
         
     | 
| 
      
 250 
     | 
    
         
            +
                  solr_doc =  @test_ds.to_solr
         
     | 
| 
      
 251 
     | 
    
         
            +
                  
         
     | 
| 
      
 252 
     | 
    
         
            +
                  #should have these
         
     | 
| 
      
 253 
     | 
    
         
            +
                        
         
     | 
| 
      
 254 
     | 
    
         
            +
                  solr_doc[:publisher_field].should == "publisher1"
         
     | 
| 
      
 255 
     | 
    
         
            +
                  solr_doc[:coverage_field].should == "coverage1"
         
     | 
| 
      
 256 
     | 
    
         
            +
                  solr_doc[:creation_date_date].should == "fake-date"
         
     | 
| 
      
 257 
     | 
    
         
            +
                  solr_doc[:mydate_date].should == "fake-date"
         
     | 
| 
      
 258 
     | 
    
         
            +
                  
         
     | 
| 
      
 259 
     | 
    
         
            +
                  solr_doc[:publisher_t].should be_nil
         
     | 
| 
      
 260 
     | 
    
         
            +
                  solr_doc[:coverage_t].should be_nil
         
     | 
| 
      
 261 
     | 
    
         
            +
                  solr_doc[:creation_date_dt].should be_nil
         
     | 
| 
      
 262 
     | 
    
         
            +
                  
         
     | 
| 
      
 263 
     | 
    
         
            +
                  # Reload default mappings
         
     | 
| 
      
 264 
     | 
    
         
            +
                  ActiveFedora::SolrService.load_mappings
         
     | 
| 
      
 265 
     | 
    
         
            +
                end
         
     | 
| 
      
 266 
     | 
    
         
            +
                
         
     | 
| 
      
 267 
     | 
    
         
            +
                it 'should append _dt to dates' do
         
     | 
| 
      
 268 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields).at_least_once
         
     | 
| 
      
 269 
     | 
    
         
            +
                  
         
     | 
| 
      
 270 
     | 
    
         
            +
                  #should have these
         
     | 
| 
      
 271 
     | 
    
         
            +
                  
         
     | 
| 
      
 272 
     | 
    
         
            +
                  @test_ds.to_solr[:creation_date_dt].should_not be_nil
         
     | 
| 
      
 273 
     | 
    
         
            +
                  @test_ds.to_solr[:mydate_dt].should_not be_nil
         
     | 
| 
      
 274 
     | 
    
         
            +
                  
         
     | 
| 
      
 275 
     | 
    
         
            +
                  #should NOT have these
         
     | 
| 
      
 276 
     | 
    
         
            +
                  
         
     | 
| 
      
 277 
     | 
    
         
            +
                  @test_ds.to_solr[:mydate].should be_nil
         
     | 
| 
      
 278 
     | 
    
         
            +
                  @test_ds.to_solr[:creation_date_date].should be_nil
         
     | 
| 
      
 279 
     | 
    
         
            +
                end
         
     | 
| 
      
 280 
     | 
    
         
            +
                
         
     | 
| 
      
 281 
     | 
    
         
            +
              end
         
     | 
| 
      
 282 
     | 
    
         
            +
              
         
     | 
| 
      
 283 
     | 
    
         
            +
              describe '.fields' do
         
     | 
| 
      
 284 
     | 
    
         
            +
                it "should return a Hash" do
         
     | 
| 
      
 285 
     | 
    
         
            +
                  @test_ds.fields.should be_instance_of(Hash)
         
     | 
| 
      
 286 
     | 
    
         
            +
                end
         
     | 
| 
      
 287 
     | 
    
         
            +
              end
         
     | 
| 
      
 288 
     | 
    
         
            +
              
         
     | 
| 
      
 289 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,301 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.join( File.dirname(__FILE__), "../spec_helper" )
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'active_fedora'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_fedora/nokogiri_datastream'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            describe ActiveFedora::NokogiriDatastream do
         
     | 
| 
      
 7 
     | 
    
         
            +
              
         
     | 
| 
      
 8 
     | 
    
         
            +
              before(:all) do
         
     | 
| 
      
 9 
     | 
    
         
            +
                @sample_fields = {:publisher => {:values => ["publisher1"], :type => :string}, 
         
     | 
| 
      
 10 
     | 
    
         
            +
                                  :coverage => {:values => ["coverage1", "coverage2"], :type => :text}, 
         
     | 
| 
      
 11 
     | 
    
         
            +
                                  :creation_date => {:values => "fake-date", :type => :date},
         
     | 
| 
      
 12 
     | 
    
         
            +
                                  :mydate => {:values => "fake-date", :type => :date},
         
     | 
| 
      
 13 
     | 
    
         
            +
                                  :empty_field => {:values => {}}
         
     | 
| 
      
 14 
     | 
    
         
            +
                                  } 
         
     | 
| 
      
 15 
     | 
    
         
            +
                @sample_xml = XmlSimple.xml_in("<fields><coverage>coverage1</coverage><coverage>coverage2</coverage><creation_date>fake-date</creation_date><mydate>fake-date</mydate><publisher>publisher1</publisher></fields>")
         
     | 
| 
      
 16 
     | 
    
         
            +
                
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
              
         
     | 
| 
      
 19 
     | 
    
         
            +
              before(:each) do
         
     | 
| 
      
 20 
     | 
    
         
            +
                @test_ds = ActiveFedora::NokogiriDatastream.new
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
              after(:each) do
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              describe '#new' do
         
     | 
| 
      
 27 
     | 
    
         
            +
                it 'should provide #new' do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  ActiveFedora::NokogiriDatastream.should respond_to(:new)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @test_ds.ng_xml.should be_instance_of(Nokogiri::XML::Document)
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
              
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              it 'should provide .fields' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                @test_ds.should respond_to(:fields)
         
     | 
| 
      
 36 
     | 
    
         
            +
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
              
         
     | 
| 
      
 38 
     | 
    
         
            +
              describe '.save' do
         
     | 
| 
      
 39 
     | 
    
         
            +
                it "should provide .save" do
         
     | 
| 
      
 40 
     | 
    
         
            +
                  @test_ds.should respond_to(:save)
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
                it "should persist the product of .to_xml in fedora" do
         
     | 
| 
      
 43 
     | 
    
         
            +
                  Fedora::Repository.instance.expects(:save)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  @test_ds.expects(:to_xml).returns("fake xml")
         
     | 
| 
      
 45 
     | 
    
         
            +
                  @test_ds.expects(:blob=).with("fake xml")
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @test_ds.save
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
              
         
     | 
| 
      
 50 
     | 
    
         
            +
              describe '.to_xml' do
         
     | 
| 
      
 51 
     | 
    
         
            +
                it "should provide .to_xml" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  @test_ds.should respond_to(:to_xml)
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
                it 'should output the fields hash as XML' do
         
     | 
| 
      
 55 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  returned_xml = XmlSimple.xml_in(@test_ds.to_xml)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  returned_xml.should == @sample_xml
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                
         
     | 
| 
      
 60 
     | 
    
         
            +
                it 'should accept an optional REXML Document as an argument and insert its fields into that' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  rexml = REXML::Document.new("<test_rexml/>")
         
     | 
| 
      
 63 
     | 
    
         
            +
                  rexml.root.elements.expects(:add).times(5)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  result = @test_ds.to_xml(rexml)
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
                it 'should accept an optional REXML Document as an argument and insert its fields into that' do
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  rexml = REXML::Document.new("<test_rexml/>")
         
     | 
| 
      
 69 
     | 
    
         
            +
                  result = @test_ds.to_xml(rexml)
         
     | 
| 
      
 70 
     | 
    
         
            +
                  XmlSimple.xml_in(rexml.to_s).should == @sample_xml
         
     | 
| 
      
 71 
     | 
    
         
            +
                  XmlSimple.xml_in(result).should == @sample_xml
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
                
         
     | 
| 
      
 74 
     | 
    
         
            +
                it 'should add to root of REXML::Documents, but add directly to the elements if a REXML::Element is passed in' do
         
     | 
| 
      
 75 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields).times(2)
         
     | 
| 
      
 76 
     | 
    
         
            +
                  doc = REXML::Document.new("<test_document/>")
         
     | 
| 
      
 77 
     | 
    
         
            +
                  el = REXML::Element.new("<test_element/>")
         
     | 
| 
      
 78 
     | 
    
         
            +
                  doc.root.elements.expects(:add).times(5)
         
     | 
| 
      
 79 
     | 
    
         
            +
                  el.expects(:add).times(5)
         
     | 
| 
      
 80 
     | 
    
         
            +
                  @test_ds.to_xml(doc)
         
     | 
| 
      
 81 
     | 
    
         
            +
                  @test_ds.to_xml(el)
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
                
         
     | 
| 
      
 84 
     | 
    
         
            +
              end
         
     | 
| 
      
 85 
     | 
    
         
            +
              
         
     | 
| 
      
 86 
     | 
    
         
            +
              describe '.set_blob_for_save' do
         
     | 
| 
      
 87 
     | 
    
         
            +
                it "should provide .set_blob_for_save" do
         
     | 
| 
      
 88 
     | 
    
         
            +
                  @test_ds.should respond_to(:set_blob_for_save)
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
                
         
     | 
| 
      
 91 
     | 
    
         
            +
                it "should set the blob to to_xml" do
         
     | 
| 
      
 92 
     | 
    
         
            +
                  @test_ds.expects(:blob=).with(@test_ds.to_xml)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  @test_ds.set_blob_for_save
         
     | 
| 
      
 94 
     | 
    
         
            +
                end
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
      
 96 
     | 
    
         
            +
              
         
     | 
| 
      
 97 
     | 
    
         
            +
              describe '#field' do
         
     | 
| 
      
 98 
     | 
    
         
            +
                
         
     | 
| 
      
 99 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 100 
     | 
    
         
            +
                  class SpecDatastream < ActiveFedora::MetadataDatastream
         
     | 
| 
      
 101 
     | 
    
         
            +
                    def initialize
         
     | 
| 
      
 102 
     | 
    
         
            +
                    super
         
     | 
| 
      
 103 
     | 
    
         
            +
                    field :publisher, :string
         
     | 
| 
      
 104 
     | 
    
         
            +
                    field :coverage, :text
         
     | 
| 
      
 105 
     | 
    
         
            +
                    field :creation_date, :date
         
     | 
| 
      
 106 
     | 
    
         
            +
                    field :mydate, :date
         
     | 
| 
      
 107 
     | 
    
         
            +
                    field :mycomplicated_field, :string, :multiple=>false, :encoding=>'LCSH', :element_attrs=>{:foo=>:bar, :baz=>:bat}
         
     | 
| 
      
 108 
     | 
    
         
            +
                    end
         
     | 
| 
      
 109 
     | 
    
         
            +
                  end
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
                
         
     | 
| 
      
 112 
     | 
    
         
            +
                after(:each) do
         
     | 
| 
      
 113 
     | 
    
         
            +
                  Object.send(:remove_const, :SpecDatastream)
         
     | 
| 
      
 114 
     | 
    
         
            +
                end
         
     | 
| 
      
 115 
     | 
    
         
            +
                
         
     | 
| 
      
 116 
     | 
    
         
            +
                
         
     | 
| 
      
 117 
     | 
    
         
            +
                decribe ".values" 
         
     | 
| 
      
 118 
     | 
    
         
            +
                  it "should call ng_xml.values_for(#{field_name}) OR call corresponding lookup method and build an array of values by calling .value on each node in the set"
         
     | 
| 
      
 119 
     | 
    
         
            +
                end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
                decribe ".values<<" 
         
     | 
| 
      
 122 
     | 
    
         
            +
                  it "should call corresponding builder method"
         
     | 
| 
      
 123 
     | 
    
         
            +
                end
         
     | 
| 
      
 124 
     | 
    
         
            +
              
         
     | 
| 
      
 125 
     | 
    
         
            +
                decribe ".values=" 
         
     | 
| 
      
 126 
     | 
    
         
            +
                  it "should wipe out any existing nodes, use the corresponding builder, and insert new node(s) as the replacement"
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
                
         
     | 
| 
      
 129 
     | 
    
         
            +
                it 'should add corresponding field to the @fields hash and set the field :type ' do
         
     | 
| 
      
 130 
     | 
    
         
            +
                  sds = SpecDatastream.new
         
     | 
| 
      
 131 
     | 
    
         
            +
                  sds.fields.should_not have_key(:bio)
         
     | 
| 
      
 132 
     | 
    
         
            +
                  sds.field :bio, :text
         
     | 
| 
      
 133 
     | 
    
         
            +
                  sds.fields.should have_key(:bio)
         
     | 
| 
      
 134 
     | 
    
         
            +
                  sds.fields[:bio].should have_key(:type)
         
     | 
| 
      
 135 
     | 
    
         
            +
                  sds.fields[:bio][:type].should == :text
         
     | 
| 
      
 136 
     | 
    
         
            +
                  sds.fields[:mycomplicated_field][:element_attrs].should == {:foo=>:bar, :baz=>:bat}
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
                
         
     | 
| 
      
 139 
     | 
    
         
            +
                # it "should insert custom element attrs into the xml stream" do
         
     | 
| 
      
 140 
     | 
    
         
            +
                #   sds = SpecDatastream.new
         
     | 
| 
      
 141 
     | 
    
         
            +
                #   sds.mycomplicated_field_values='foo'
         
     | 
| 
      
 142 
     | 
    
         
            +
                #   sds.fields[:mycomplicated_field][:element_attrs].should == {:foo=>:bar, :baz=>:bat}
         
     | 
| 
      
 143 
     | 
    
         
            +
                #   sds.to_xml.should == '<fields><mycomplicated_field baz=\'bat\' foo=\'bar\'>foo</mycomplicated_field></fields>'
         
     | 
| 
      
 144 
     | 
    
         
            +
                # end
         
     | 
| 
      
 145 
     | 
    
         
            +
                
         
     | 
| 
      
 146 
     | 
    
         
            +
                it "should add getters and setters and appenders with field name" do
         
     | 
| 
      
 147 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 148 
     | 
    
         
            +
                  local_test_ds.should respond_to(:publisher_values)
         
     | 
| 
      
 149 
     | 
    
         
            +
                  local_test_ds.should respond_to(:publisher_append)
         
     | 
| 
      
 150 
     | 
    
         
            +
                  local_test_ds.should respond_to(:publisher_values=)
         
     | 
| 
      
 151 
     | 
    
         
            +
                  local_test_ds.publisher_values.class.should == Array
         
     | 
| 
      
 152 
     | 
    
         
            +
                  local_test_ds.should respond_to(:coverage_values)
         
     | 
| 
      
 153 
     | 
    
         
            +
                  local_test_ds.should respond_to(:coverage_values=)
         
     | 
| 
      
 154 
     | 
    
         
            +
                  local_test_ds.should respond_to(:coverage_append)
         
     | 
| 
      
 155 
     | 
    
         
            +
                  local_test_ds.should respond_to(:creation_date_values)
         
     | 
| 
      
 156 
     | 
    
         
            +
                  local_test_ds.should respond_to(:creation_date_append)
         
     | 
| 
      
 157 
     | 
    
         
            +
                  local_test_ds.should respond_to(:creation_date_values=)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  local_test_ds.should respond_to(:mydate_values)
         
     | 
| 
      
 159 
     | 
    
         
            +
                  local_test_ds.should respond_to(:mydate_append)
         
     | 
| 
      
 160 
     | 
    
         
            +
                  local_test_ds.should respond_to(:mydate_values=)
         
     | 
| 
      
 161 
     | 
    
         
            +
                end
         
     | 
| 
      
 162 
     | 
    
         
            +
                
         
     | 
| 
      
 163 
     | 
    
         
            +
                it "should track field values at instance level, not at class level" do
         
     | 
| 
      
 164 
     | 
    
         
            +
                  local_test_ds1 = SpecDatastream.new
         
     | 
| 
      
 165 
     | 
    
         
            +
                  local_test_ds2 = SpecDatastream.new
         
     | 
| 
      
 166 
     | 
    
         
            +
                  local_test_ds1.publisher_values = ["publisher1", "publisher2"]
         
     | 
| 
      
 167 
     | 
    
         
            +
                  local_test_ds2.publisher_values = ["publisherA", "publisherB"]
         
     | 
| 
      
 168 
     | 
    
         
            +
                  
         
     | 
| 
      
 169 
     | 
    
         
            +
                  local_test_ds2.publisher_values.should == ["publisherA", "publisherB"]      
         
     | 
| 
      
 170 
     | 
    
         
            +
                  local_test_ds1.publisher_values.should == ["publisher1", "publisher2"]
         
     | 
| 
      
 171 
     | 
    
         
            +
                end
         
     | 
| 
      
 172 
     | 
    
         
            +
                
         
     | 
| 
      
 173 
     | 
    
         
            +
                it "should allow you to add field values using <<" do
         
     | 
| 
      
 174 
     | 
    
         
            +
                  local_test_ds1 = SpecDatastream.new
         
     | 
| 
      
 175 
     | 
    
         
            +
                  local_test_ds1.publisher_values << "publisher1"
         
     | 
| 
      
 176 
     | 
    
         
            +
                  local_test_ds1.publisher_values.should == ["publisher1"] 
         
     | 
| 
      
 177 
     | 
    
         
            +
                end
         
     | 
| 
      
 178 
     | 
    
         
            +
                
         
     | 
| 
      
 179 
     | 
    
         
            +
                it "should create setter that always turns non-arrays into arrays" do
         
     | 
| 
      
 180 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 181 
     | 
    
         
            +
                  local_test_ds.publisher_values = "Foo"
         
     | 
| 
      
 182 
     | 
    
         
            +
                  local_test_ds.publisher_values.should == ["Foo"]
         
     | 
| 
      
 183 
     | 
    
         
            +
                end
         
     | 
| 
      
 184 
     | 
    
         
            +
                
         
     | 
| 
      
 185 
     | 
    
         
            +
                it "should create setter that sets datastream.dirty? to true" do
         
     | 
| 
      
 186 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 187 
     | 
    
         
            +
                  local_test_ds.should_not be_dirty
         
     | 
| 
      
 188 
     | 
    
         
            +
                  local_test_ds.publisher_values = "Foo"
         
     | 
| 
      
 189 
     | 
    
         
            +
                  local_test_ds.should be_dirty
         
     | 
| 
      
 190 
     | 
    
         
            +
                  
         
     | 
| 
      
 191 
     | 
    
         
            +
                  # Note: If you use << to append values, the datastream will not be marked as dirty!
         
     | 
| 
      
 192 
     | 
    
         
            +
                  #local_test_ds.dirty = false
         
     | 
| 
      
 193 
     | 
    
         
            +
                  
         
     | 
| 
      
 194 
     | 
    
         
            +
                  #local_test_ds.should_not be_dirty
         
     | 
| 
      
 195 
     | 
    
         
            +
                  #local_test_ds.publisher_values << "Foo"
         
     | 
| 
      
 196 
     | 
    
         
            +
                  #local_test_ds.should be_dirty      
         
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
      
 198 
     | 
    
         
            +
                
         
     | 
| 
      
 199 
     | 
    
         
            +
                it "should add any extra opts to the field hash" do
         
     | 
| 
      
 200 
     | 
    
         
            +
                  local_test_ds = SpecDatastream.new
         
     | 
| 
      
 201 
     | 
    
         
            +
                  local_test_ds.field "myfield", :string, :foo => "foo", :bar => "bar"      
         
     | 
| 
      
 202 
     | 
    
         
            +
                  local_test_ds.fields[:myfield].should have_key(:foo)
         
     | 
| 
      
 203 
     | 
    
         
            +
                  local_test_ds.fields[:myfield][:foo].should == "foo"
         
     | 
| 
      
 204 
     | 
    
         
            +
                  local_test_ds.fields[:myfield].should have_key(:bar)
         
     | 
| 
      
 205 
     | 
    
         
            +
                  local_test_ds.fields[:myfield][:bar].should == "bar"      
         
     | 
| 
      
 206 
     | 
    
         
            +
                end
         
     | 
| 
      
 207 
     | 
    
         
            +
                
         
     | 
| 
      
 208 
     | 
    
         
            +
              end
         
     | 
| 
      
 209 
     | 
    
         
            +
              
         
     | 
| 
      
 210 
     | 
    
         
            +
              describe ".to_solr" do
         
     | 
| 
      
 211 
     | 
    
         
            +
                
         
     | 
| 
      
 212 
     | 
    
         
            +
                after(:all) do
         
     | 
| 
      
 213 
     | 
    
         
            +
                  # Revert to default mappings after running tests
         
     | 
| 
      
 214 
     | 
    
         
            +
                  ActiveFedora::SolrService.load_mappings
         
     | 
| 
      
 215 
     | 
    
         
            +
                end
         
     | 
| 
      
 216 
     | 
    
         
            +
                
         
     | 
| 
      
 217 
     | 
    
         
            +
                it "should iterate through the class fields, calling .values on each and appending the values to the solr doc"
         
     | 
| 
      
 218 
     | 
    
         
            +
                
         
     | 
| 
      
 219 
     | 
    
         
            +
                it "should provide .to_solr and return a SolrDocument" do
         
     | 
| 
      
 220 
     | 
    
         
            +
                  @test_ds.should respond_to(:to_solr)
         
     | 
| 
      
 221 
     | 
    
         
            +
                  @test_ds.to_solr.should be_kind_of(Solr::Document)
         
     | 
| 
      
 222 
     | 
    
         
            +
                end
         
     | 
| 
      
 223 
     | 
    
         
            +
                
         
     | 
| 
      
 224 
     | 
    
         
            +
                it "should optionally allow you to provide the Solr::Document to add fields to and return that document when done" do
         
     | 
| 
      
 225 
     | 
    
         
            +
                  doc = Solr::Document.new
         
     | 
| 
      
 226 
     | 
    
         
            +
                  @test_ds.to_solr(doc).should equal(doc)
         
     | 
| 
      
 227 
     | 
    
         
            +
                end
         
     | 
| 
      
 228 
     | 
    
         
            +
                
         
     | 
| 
      
 229 
     | 
    
         
            +
                it "should iterate through @fields hash" do
         
     | 
| 
      
 230 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields)
         
     | 
| 
      
 231 
     | 
    
         
            +
                  solr_doc =  @test_ds.to_solr
         
     | 
| 
      
 232 
     | 
    
         
            +
                  
         
     | 
| 
      
 233 
     | 
    
         
            +
                  solr_doc[:publisher_t].should == "publisher1"
         
     | 
| 
      
 234 
     | 
    
         
            +
                  solr_doc[:coverage_t].should == "coverage1"
         
     | 
| 
      
 235 
     | 
    
         
            +
                  solr_doc[:creation_date_dt].should == "fake-date"
         
     | 
| 
      
 236 
     | 
    
         
            +
                  solr_doc[:mydate_dt].should == "fake-date"
         
     | 
| 
      
 237 
     | 
    
         
            +
                  
         
     | 
| 
      
 238 
     | 
    
         
            +
                  solr_doc[:empty_field_t].should be_nil
         
     | 
| 
      
 239 
     | 
    
         
            +
                end
         
     | 
| 
      
 240 
     | 
    
         
            +
                
         
     | 
| 
      
 241 
     | 
    
         
            +
                it "should allow multiple values for a single field"
         
     | 
| 
      
 242 
     | 
    
         
            +
                
         
     | 
| 
      
 243 
     | 
    
         
            +
                it 'should append create keys in format field_name + _ + field_type' do
         
     | 
| 
      
 244 
     | 
    
         
            +
                  @test_ds.stubs(:fields).returns(@sample_fields)
         
     | 
| 
      
 245 
     | 
    
         
            +
                  
         
     | 
| 
      
 246 
     | 
    
         
            +
                  #should have these
         
     | 
| 
      
 247 
     | 
    
         
            +
                        
         
     | 
| 
      
 248 
     | 
    
         
            +
                  @test_ds.to_solr[:publisher_t].should_not be_nil
         
     | 
| 
      
 249 
     | 
    
         
            +
                  @test_ds.to_solr[:coverage_t].should_not be_nil
         
     | 
| 
      
 250 
     | 
    
         
            +
                  @test_ds.to_solr[:creation_date_dt].should_not be_nil
         
     | 
| 
      
 251 
     | 
    
         
            +
                  
         
     | 
| 
      
 252 
     | 
    
         
            +
                  #should NOT have these
         
     | 
| 
      
 253 
     | 
    
         
            +
                  @test_ds.to_solr[:narrator].should be_nil
         
     | 
| 
      
 254 
     | 
    
         
            +
                  @test_ds.to_solr[:title].should be_nil
         
     | 
| 
      
 255 
     | 
    
         
            +
                  @test_ds.to_solr[:empty_field].should be_nil
         
     | 
| 
      
 256 
     | 
    
         
            +
                  
         
     | 
| 
      
 257 
     | 
    
         
            +
                end
         
     | 
| 
      
 258 
     | 
    
         
            +
                
         
     | 
| 
      
 259 
     | 
    
         
            +
                it "should use Solr mappings to generate field names" do
         
     | 
| 
      
 260 
     | 
    
         
            +
                  ActiveFedora::SolrService.load_mappings(File.join(File.dirname(__FILE__), "..", "..", "config", "solr_mappings_af_0.1.yml"))
         
     | 
| 
      
 261 
     | 
    
         
            +
                  @test_ds.stubs(:fields).returns(@sample_fields)
         
     | 
| 
      
 262 
     | 
    
         
            +
                  solr_doc =  @test_ds.to_solr
         
     | 
| 
      
 263 
     | 
    
         
            +
                  
         
     | 
| 
      
 264 
     | 
    
         
            +
                  #should have these
         
     | 
| 
      
 265 
     | 
    
         
            +
                        
         
     | 
| 
      
 266 
     | 
    
         
            +
                  solr_doc[:publisher_field].should == "publisher1"
         
     | 
| 
      
 267 
     | 
    
         
            +
                  solr_doc[:coverage_field].should == "coverage1"
         
     | 
| 
      
 268 
     | 
    
         
            +
                  solr_doc[:creation_date_date].should == "fake-date"
         
     | 
| 
      
 269 
     | 
    
         
            +
                  solr_doc[:mydate_date].should == "fake-date"
         
     | 
| 
      
 270 
     | 
    
         
            +
                  
         
     | 
| 
      
 271 
     | 
    
         
            +
                  solr_doc[:publisher_t].should be_nil
         
     | 
| 
      
 272 
     | 
    
         
            +
                  solr_doc[:coverage_t].should be_nil
         
     | 
| 
      
 273 
     | 
    
         
            +
                  solr_doc[:creation_date_dt].should be_nil
         
     | 
| 
      
 274 
     | 
    
         
            +
                  
         
     | 
| 
      
 275 
     | 
    
         
            +
                  # Reload default mappings
         
     | 
| 
      
 276 
     | 
    
         
            +
                  ActiveFedora::SolrService.load_mappings
         
     | 
| 
      
 277 
     | 
    
         
            +
                end
         
     | 
| 
      
 278 
     | 
    
         
            +
                
         
     | 
| 
      
 279 
     | 
    
         
            +
                it 'should append _dt to dates' do
         
     | 
| 
      
 280 
     | 
    
         
            +
                  @test_ds.expects(:fields).returns(@sample_fields).at_least_once
         
     | 
| 
      
 281 
     | 
    
         
            +
                  
         
     | 
| 
      
 282 
     | 
    
         
            +
                  #should have these
         
     | 
| 
      
 283 
     | 
    
         
            +
                  
         
     | 
| 
      
 284 
     | 
    
         
            +
                  @test_ds.to_solr[:creation_date_dt].should_not be_nil
         
     | 
| 
      
 285 
     | 
    
         
            +
                  @test_ds.to_solr[:mydate_dt].should_not be_nil
         
     | 
| 
      
 286 
     | 
    
         
            +
                  
         
     | 
| 
      
 287 
     | 
    
         
            +
                  #should NOT have these
         
     | 
| 
      
 288 
     | 
    
         
            +
                  
         
     | 
| 
      
 289 
     | 
    
         
            +
                  @test_ds.to_solr[:mydate].should be_nil
         
     | 
| 
      
 290 
     | 
    
         
            +
                  @test_ds.to_solr[:creation_date_date].should be_nil
         
     | 
| 
      
 291 
     | 
    
         
            +
                end
         
     | 
| 
      
 292 
     | 
    
         
            +
                
         
     | 
| 
      
 293 
     | 
    
         
            +
              end
         
     | 
| 
      
 294 
     | 
    
         
            +
              
         
     | 
| 
      
 295 
     | 
    
         
            +
              describe '.fields' do
         
     | 
| 
      
 296 
     | 
    
         
            +
                it "should return a Hash" do
         
     | 
| 
      
 297 
     | 
    
         
            +
                  @test_ds.fields.should be_instance_of(Hash)
         
     | 
| 
      
 298 
     | 
    
         
            +
                end
         
     | 
| 
      
 299 
     | 
    
         
            +
              end
         
     | 
| 
      
 300 
     | 
    
         
            +
              
         
     | 
| 
      
 301 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,6 +2,7 @@ require File.join( File.dirname(__FILE__), "../spec_helper" ) 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_fedora'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'xmlsimple'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'nokogiri'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            describe ActiveFedora::QualifiedDublinCoreDatastream do
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
         @@ -44,8 +45,10 @@ describe ActiveFedora::QualifiedDublinCoreDatastream do 
     | 
|
| 
       44 
45 
     | 
    
         
             
                tmpl.expects(:publisher_append).with('jwa')
         
     | 
| 
       45 
46 
     | 
    
         
             
                tmpl.expects(:description_append).with('desc')
         
     | 
| 
       46 
47 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                 
     | 
| 
       48 
     | 
    
         
            -
                 
     | 
| 
      
 48 
     | 
    
         
            +
                sample_xml = fixture('oh_qdc.xml')
         
     | 
| 
      
 49 
     | 
    
         
            +
                sample_ds_xml = Nokogiri::XML::Document.parse(sample_xml).xpath('//foxml:datastream').first
         
     | 
| 
      
 50 
     | 
    
         
            +
                
         
     | 
| 
      
 51 
     | 
    
         
            +
                z = ActiveFedora::QualifiedDublinCoreDatastream.from_xml(tmpl, sample_ds_xml)
         
     | 
| 
       49 
52 
     | 
    
         
             
                z.should === tmpl
         
     | 
| 
       50 
53 
     | 
    
         
             
              end
         
     | 
| 
       51 
54 
     | 
    
         | 
| 
         @@ -59,10 +62,10 @@ describe ActiveFedora::QualifiedDublinCoreDatastream do 
     | 
|
| 
       59 
62 
     | 
    
         
             
              end
         
     | 
| 
       60 
63 
     | 
    
         | 
| 
       61 
64 
     | 
    
         
             
              it "should have identity in and out" do
         
     | 
| 
       62 
     | 
    
         
            -
                sample =  
     | 
| 
      
 65 
     | 
    
         
            +
                sample = fixture('oh_qdc.xml')
         
     | 
| 
       63 
66 
     | 
    
         
             
                tmpl = OralHistorySampleModel.new.datastreams['dublin_core']
         
     | 
| 
       64 
     | 
    
         
            -
                z = ActiveFedora::QualifiedDublinCoreDatastream.from_xml(tmpl,  
     | 
| 
       65 
     | 
    
         
            -
                y = ActiveFedora::QualifiedDublinCoreDatastream.from_xml(tmpl,  
     | 
| 
      
 67 
     | 
    
         
            +
                z = ActiveFedora::QualifiedDublinCoreDatastream.from_xml(tmpl, Nokogiri::XML::Document.parse(sample).root.children.first)
         
     | 
| 
      
 68 
     | 
    
         
            +
                y = ActiveFedora::QualifiedDublinCoreDatastream.from_xml(tmpl, Nokogiri::XML::Document.parse(z.to_dc_xml))
         
     | 
| 
       66 
69 
     | 
    
         
             
                y.to_dc_xml.should == z.to_dc_xml
         
     | 
| 
       67 
70 
     | 
    
         
             
              end
         
     | 
| 
       68 
71 
     | 
    
         | 
| 
         @@ -77,8 +80,8 @@ describe ActiveFedora::QualifiedDublinCoreDatastream do 
     | 
|
| 
       77 
80 
     | 
    
         | 
| 
       78 
81 
     | 
    
         | 
| 
       79 
82 
     | 
    
         
             
              it "should parse dcterms and dcelements from xml" do
         
     | 
| 
       80 
     | 
    
         
            -
                doc =  
     | 
| 
       81 
     | 
    
         
            -
                stream = doc. 
     | 
| 
      
 83 
     | 
    
         
            +
                doc = Nokogiri::XML::Document.parse(File.open( File.dirname(__FILE__)+'/../fixtures/changeme155.xml') )
         
     | 
| 
      
 84 
     | 
    
         
            +
                stream = doc.xpath('//foxml:datastream[@ID=\'dublin_core\']')
         
     | 
| 
       82 
85 
     | 
    
         
             
                n = ActiveFedora::QualifiedDublinCoreDatastream.from_xml(ActiveFedora::QualifiedDublinCoreDatastream.new, stream)
         
     | 
| 
       83 
86 
     | 
    
         
             
                n.spatial_values.should == ["Boston [7013445]", "Dorchester [7013575]", "Roxbury [7015002]"] 
         
     | 
| 
       84 
87 
     | 
    
         
             
                n.title_values.should ==  ["Oral history with Frances Addelson, 1997 November 14"]
         
     | 
| 
         @@ -134,7 +137,7 @@ describe ActiveFedora::QualifiedDublinCoreDatastream do 
     | 
|
| 
       134 
137 
     | 
    
         | 
| 
       135 
138 
     | 
    
         | 
| 
       136 
139 
     | 
    
         
             
                #
         
     | 
| 
       137 
     | 
    
         
            -
                # I think the fields should just be tracked as a  
     | 
| 
      
 140 
     | 
    
         
            +
                # I think the fields should just be tracked as a Nokogiri::XML::Document internally.  Too much BS otherwise.
         
     | 
| 
       138 
141 
     | 
    
         
             
                #
         
     | 
| 
       139 
142 
     | 
    
         | 
| 
       140 
143 
     | 
    
         | 
| 
         @@ -158,7 +161,7 @@ describe ActiveFedora::QualifiedDublinCoreDatastream do 
     | 
|
| 
       158 
161 
     | 
    
         | 
| 
       159 
162 
     | 
    
         
             
                it "should use specified :xml_node if it is available in the field Hash" do
         
     | 
| 
       160 
163 
     | 
    
         
             
                  @test_ds.stubs(:fields).returns({:myfieldname => {:values => ["sample spatial coverage"], :xml_node => "nodename" }})
         
     | 
| 
       161 
     | 
    
         
            -
                   
     | 
| 
      
 164 
     | 
    
         
            +
                  Nokogiri::XML::Document.parse(@test_ds.to_dc_xml).xpath('./dc/dcterms:nodename').text.should ==  'sample spatial coverage'
         
     | 
| 
       162 
165 
     | 
    
         
             
                end
         
     | 
| 
       163 
166 
     | 
    
         | 
| 
       164 
167 
     | 
    
         
             
                it "should use specified :xml_node if it was specified when .field was called" do
         
     | 
| 
         @@ -2,6 +2,7 @@ require File.join( File.dirname(__FILE__), "../spec_helper" ) 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_fedora'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require "rexml/document"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "nokogiri"
         
     | 
| 
       5 
6 
     | 
    
         
             
            require 'ftools'
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            describe ActiveFedora::RelsExtDatastream do
         
     | 
| 
         @@ -12,7 +13,7 @@ describe ActiveFedora::RelsExtDatastream do 
     | 
|
| 
       12 
13 
     | 
    
         
             
                @test_relationship2 = ActiveFedora::Relationship.new(:subject => :self, :predicate => :is_part_of, :object => "demo:11")  
         
     | 
| 
       13 
14 
     | 
    
         
             
                @test_relationship3 = ActiveFedora::Relationship.new(:subject => @pid, :predicate => :has_part, :object => "demo:12")  
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                @sample_xml =  
     | 
| 
      
 16 
     | 
    
         
            +
                @sample_xml = Nokogiri::XML::Document.parse(@sample_xml_string)
         
     | 
| 
       16 
17 
     | 
    
         
             
              end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
              before(:each) do
         
     | 
| 
         @@ -65,8 +66,8 @@ describe ActiveFedora::RelsExtDatastream do 
     | 
|
| 
       65 
66 
     | 
    
         
             
                end
         
     | 
| 
       66 
67 
     | 
    
         
             
                it "should load RELS-EXT relationships into relationships hash" do
         
     | 
| 
       67 
68 
     | 
    
         
             
                  @test_obj.relationships.should == {:self=>{:is_member_of=>["info:fedora/demo:10"], :is_part_of=>["info:fedora/demo:11"], :has_model=>["info:fedora/afmodel:ActiveFedora_Base"]}}
         
     | 
| 
       68 
     | 
    
         
            -
                  doc =  
     | 
| 
       69 
     | 
    
         
            -
                  el = doc. 
     | 
| 
      
 69 
     | 
    
         
            +
                  doc = Nokogiri::XML::Document.parse(@test_obj.inner_object.object_xml)
         
     | 
| 
      
 70 
     | 
    
         
            +
                  el = doc.xpath("/foxml:digitalObject//foxml:datastream[@ID='RELS-EXT']").first
         
     | 
| 
       70 
71 
     | 
    
         
             
                  new_ds = ActiveFedora::RelsExtDatastream.new
         
     | 
| 
       71 
72 
     | 
    
         
             
                  new_ds.relationships.should == {:self=>{}}
         
     | 
| 
       72 
73 
     | 
    
         
             
                  ActiveFedora::RelsExtDatastream.from_xml(new_ds,el)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,12 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: active-fedora
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              prerelease:  
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: true
         
     | 
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 1
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 1
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
      
 8 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 9 
     | 
    
         
            +
              - pre2
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 1.1.4.pre2
         
     | 
| 
       10 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
13 
     | 
    
         
             
            - Matt Zumwalt
         
     | 
| 
         @@ -15,7 +16,7 @@ autorequire: 
     | 
|
| 
       15 
16 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
17 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 19 
     | 
    
         
            +
            date: 2010-05-15 00:00:00 -05:00
         
     | 
| 
       19 
20 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
21 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
22 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -120,7 +121,7 @@ extensions: [] 
     | 
|
| 
       120 
121 
     | 
    
         
             
            extra_rdoc_files: 
         
     | 
| 
       121 
122 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       122 
123 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       123 
     | 
    
         
            -
            - README. 
     | 
| 
      
 124 
     | 
    
         
            +
            - README.textile
         
     | 
| 
       124 
125 
     | 
    
         
             
            files: 
         
     | 
| 
       125 
126 
     | 
    
         
             
            - .document
         
     | 
| 
       126 
127 
     | 
    
         
             
            - .gitignore
         
     | 
| 
         @@ -280,7 +281,7 @@ files: 
     | 
|
| 
       280 
281 
     | 
    
         
             
            - Manifest.txt
         
     | 
| 
       281 
282 
     | 
    
         
             
            - PostInstall.txt
         
     | 
| 
       282 
283 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       283 
     | 
    
         
            -
            - README. 
     | 
| 
      
 284 
     | 
    
         
            +
            - README.textile
         
     | 
| 
       284 
285 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       285 
286 
     | 
    
         
             
            - VERSION
         
     | 
| 
       286 
287 
     | 
    
         
             
            - active-fedora.gemspec
         
     | 
| 
         @@ -321,6 +322,7 @@ files: 
     | 
|
| 
       321 
322 
     | 
    
         
             
            - spec/fixtures/changeme155.xml
         
     | 
| 
       322 
323 
     | 
    
         
             
            - spec/fixtures/dino.jpg
         
     | 
| 
       323 
324 
     | 
    
         
             
            - spec/fixtures/minivan.jpg
         
     | 
| 
      
 325 
     | 
    
         
            +
            - spec/fixtures/oh_qdc.xml
         
     | 
| 
       324 
326 
     | 
    
         
             
            - spec/fixtures/test_12.foxml.xml
         
     | 
| 
       325 
327 
     | 
    
         
             
            - spec/integration/base_file_management_spec.rb
         
     | 
| 
       326 
328 
     | 
    
         
             
            - spec/integration/base_loader_spec.rb
         
     | 
| 
         @@ -341,7 +343,6 @@ files: 
     | 
|
| 
       341 
343 
     | 
    
         
             
            - spec/samples/models/oral_history.rb
         
     | 
| 
       342 
344 
     | 
    
         
             
            - spec/samples/models/seminar.rb
         
     | 
| 
       343 
345 
     | 
    
         
             
            - spec/samples/models/seminar_audio_file.rb
         
     | 
| 
       344 
     | 
    
         
            -
            - spec/samples/oh_qdc.xml
         
     | 
| 
       345 
346 
     | 
    
         
             
            - spec/samples/oral_history_sample.xml
         
     | 
| 
       346 
347 
     | 
    
         
             
            - spec/samples/oral_history_sample_model.rb
         
     | 
| 
       347 
348 
     | 
    
         
             
            - spec/samples/oral_history_xml.xml
         
     | 
| 
         @@ -391,14 +392,16 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       391 
392 
     | 
    
         
             
                  version: "0"
         
     | 
| 
       392 
393 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
       393 
394 
     | 
    
         
             
              requirements: 
         
     | 
| 
       394 
     | 
    
         
            -
              - - " 
     | 
| 
      
 395 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       395 
396 
     | 
    
         
             
                - !ruby/object:Gem::Version 
         
     | 
| 
       396 
397 
     | 
    
         
             
                  segments: 
         
     | 
| 
       397 
     | 
    
         
            -
                  -  
     | 
| 
       398 
     | 
    
         
            -
                   
     | 
| 
      
 398 
     | 
    
         
            +
                  - 1
         
     | 
| 
      
 399 
     | 
    
         
            +
                  - 3
         
     | 
| 
      
 400 
     | 
    
         
            +
                  - 1
         
     | 
| 
      
 401 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       399 
402 
     | 
    
         
             
            requirements: []
         
     | 
| 
       400 
403 
     | 
    
         | 
| 
       401 
     | 
    
         
            -
            rubyforge_project: 
         
     | 
| 
      
 404 
     | 
    
         
            +
            rubyforge_project: rubyfedora
         
     | 
| 
       402 
405 
     | 
    
         
             
            rubygems_version: 1.3.6
         
     | 
| 
       403 
406 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       404 
407 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
         @@ -439,6 +442,8 @@ test_files: 
     | 
|
| 
       439 
442 
     | 
    
         
             
            - spec/unit/inheritance_spec.rb
         
     | 
| 
       440 
443 
     | 
    
         
             
            - spec/unit/metadata_datastream_spec.rb
         
     | 
| 
       441 
444 
     | 
    
         
             
            - spec/unit/model_spec.rb
         
     | 
| 
      
 445 
     | 
    
         
            +
            - spec/unit/mods_datastream_spec.rb
         
     | 
| 
      
 446 
     | 
    
         
            +
            - spec/unit/nokogiri_datastream_spec.rb
         
     | 
| 
       442 
447 
     | 
    
         
             
            - spec/unit/property_spec.rb
         
     | 
| 
       443 
448 
     | 
    
         
             
            - spec/unit/qualified_dublin_core_datastream_spec.rb
         
     | 
| 
       444 
449 
     | 
    
         
             
            - spec/unit/relationship_spec.rb
         
     |