active-fedora 3.2.0.pre7 → 3.2.0
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/Gemfile.lock +1 -1
- data/History.txt +4 -0
- data/lib/active_fedora/content_model.rb +3 -13
- data/lib/active_fedora/metadata_datastream.rb +24 -2
- data/lib/active_fedora/metadata_datastream_helper.rb +1 -25
- data/lib/active_fedora/model.rb +12 -5
- data/lib/active_fedora/persistence.rb +1 -1
- data/lib/active_fedora/semantic_node.rb +1 -1
- data/lib/active_fedora/version.rb +1 -1
- data/lib/tasks/active_fedora.rake +0 -1
- data/spec/integration/base_spec.rb +2 -2
- data/spec/integration/bug_spec.rb +12 -7
- data/spec/integration/rels_ext_datastream_spec.rb +1 -1
- data/spec/integration/semantic_node_spec.rb +6 -6
- data/spec/samples/models/hydrangea_article.rb +2 -0
- data/spec/unit/base_file_management_spec.rb +0 -5
- data/spec/unit/base_spec.rb +3 -3
- data/spec/unit/content_model_spec.rb +6 -5
- data/spec/unit/relationships_spec.rb +6 -6
- metadata +8 -12
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/History.txt
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            3.2.0
         | 
| 2 2 |  | 
| 3 | 
            +
            Deprecate ContentModel.pid_from_ruby_class, use Model.to_class_uri instead
         | 
| 3 4 | 
             
            Added a count method
         | 
| 4 5 | 
             
            HYDRA-731 running count on a has_many relationship returns zero unless the relationship has been loaded
         | 
| 5 6 | 
             
            Added ActiveModel validations.
         | 
| @@ -19,6 +20,9 @@ ActiveFedora::Relationship is deprecated (was not being used) | |
| 19 20 | 
             
            Rails 3.1 compatibility
         | 
| 20 21 | 
             
            Ruby 1.9 compatibility
         | 
| 21 22 |  | 
| 23 | 
            +
            3.1.6
         | 
| 24 | 
            +
            HYDRA-733 When serializing, MetadataDatastream does not load the existing content, so it can overwrite with blank
         | 
| 25 | 
            +
             | 
| 22 26 | 
             
            3.1.5
         | 
| 23 27 | 
             
            HYDRA-722 updating AF::Base#label= and then saving doesn't persist the change
         | 
| 24 28 | 
             
            JettyWrapper to 1.2.0
         | 
| @@ -12,20 +12,10 @@ module ActiveFedora | |
| 12 12 | 
             
                  super
         | 
| 13 13 | 
             
                end
         | 
| 14 14 |  | 
| 15 | 
            -
                 | 
| 15 | 
            +
                # @deprecated Please use {.to_class_uri} instead
         | 
| 16 16 | 
             
                def self.pid_from_ruby_class(klass,attrs={})
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                   | 
| 19 | 
            -
                    pid_suffix = attrs.has_key?(:pid_suffix) ? attrs[:pid_suffix] : CMODEL_PID_SUFFIX
         | 
| 20 | 
            -
                  else
         | 
| 21 | 
            -
                    pid_suffix = klass.pid_suffix
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
                  unless klass.respond_to? :pid_namespace
         | 
| 24 | 
            -
                    namespace = attrs.has_key?(:namespace) ? attrs[:namespace] : CMODEL_NAMESPACE   
         | 
| 25 | 
            -
                  else
         | 
| 26 | 
            -
                    namespace = klass.pid_namespace
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
                  return "info:fedora/#{namespace}:#{sanitized_class_name(klass)}#{pid_suffix}" 
         | 
| 17 | 
            +
                  ActiveSupport::Deprecation.warn("pid_from_ruby_class is deprecated.  Use klass.to_class_uri instead")
         | 
| 18 | 
            +
                  klass.to_class_uri(attrs)
         | 
| 29 19 | 
             
                end
         | 
| 30 20 |  | 
| 31 21 | 
             
                ###Override this, if you prefer your class names serialized some other way
         | 
| @@ -8,10 +8,9 @@ module ActiveFedora | |
| 8 8 | 
             
              #   </fields>
         | 
| 9 9 | 
             
              class MetadataDatastream < Datastream
         | 
| 10 10 |  | 
| 11 | 
            +
                # .to_solr (among other things) is provided by ActiveFedora::MetadataDatastreamHelper
         | 
| 11 12 | 
             
                include ActiveFedora::MetadataDatastreamHelper
         | 
| 12 13 |  | 
| 13 | 
            -
                # .to_solr and .to_xml (among other things) are provided by ActiveFedora::MetadataDatastreamHelper
         | 
| 14 | 
            -
                self.xml_model = ActiveFedora::MetadataDatastream    
         | 
| 15 14 |  | 
| 16 15 | 
             
                def update_attributes(params={},opts={})
         | 
| 17 16 | 
             
                  result = params.dup
         | 
| @@ -144,6 +143,29 @@ module ActiveFedora | |
| 144 143 | 
             
                  tmpl.send(:dirty=, false)
         | 
| 145 144 | 
             
                  tmpl
         | 
| 146 145 | 
             
                end
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                def to_xml(xml = Nokogiri::XML::Document.parse("<fields />")) #:nodoc:
         | 
| 148 | 
            +
                  if xml.instance_of?(Nokogiri::XML::Builder)
         | 
| 149 | 
            +
                    xml_insertion_point = xml.doc.root 
         | 
| 150 | 
            +
                  elsif xml.instance_of?(Nokogiri::XML::Document) 
         | 
| 151 | 
            +
                    xml_insertion_point = xml.root
         | 
| 152 | 
            +
                  else
         | 
| 153 | 
            +
                    xml_insertion_point = xml
         | 
| 154 | 
            +
                  end
         | 
| 155 | 
            +
                  
         | 
| 156 | 
            +
                  builder = Nokogiri::XML::Builder.with(xml_insertion_point) do |xml|
         | 
| 157 | 
            +
                    fields.each_pair do |field,field_info|
         | 
| 158 | 
            +
                      element_attrs = field_info[:element_attrs].nil? ? {} : field_info[:element_attrs]
         | 
| 159 | 
            +
                      values = field_info[:values]
         | 
| 160 | 
            +
                      values = [values] unless values.respond_to? :each
         | 
| 161 | 
            +
                      values.each do |val|
         | 
| 162 | 
            +
                        builder_arg = "xml.#{field}(val, element_attrs)"
         | 
| 163 | 
            +
                        eval(builder_arg)
         | 
| 164 | 
            +
                      end
         | 
| 165 | 
            +
                    end
         | 
| 166 | 
            +
                  end
         | 
| 167 | 
            +
                  return builder.to_xml
         | 
| 168 | 
            +
                end
         | 
| 147 169 |  | 
| 148 170 | 
             
                # This method generates the various accessor and mutator methods on self for the datastream metadata attributes.
         | 
| 149 171 | 
             
                # each field will have the 3 magic methods:
         | 
| @@ -7,8 +7,6 @@ module ActiveFedora::MetadataDatastreamHelper | |
| 7 7 |  | 
| 8 8 | 
             
              module ClassMethods
         | 
| 9 9 |  | 
| 10 | 
            -
                attr_accessor :xml_model
         | 
| 11 | 
            -
                
         | 
| 12 10 | 
             
                #get the Class's field list
         | 
| 13 11 | 
             
                def fields
         | 
| 14 12 | 
             
                  @@classFields
         | 
| @@ -34,7 +32,7 @@ module ActiveFedora::MetadataDatastreamHelper | |
| 34 32 |  | 
| 35 33 | 
             
              def serialize! # :nodoc:
         | 
| 36 34 | 
             
                if dirty?
         | 
| 37 | 
            -
                  self.content = self.to_xml | 
| 35 | 
            +
                  self.content = self.to_xml 
         | 
| 38 36 | 
             
                end
         | 
| 39 37 | 
             
              end
         | 
| 40 38 |  | 
| @@ -77,27 +75,5 @@ module ActiveFedora::MetadataDatastreamHelper | |
| 77 75 | 
             
                end
         | 
| 78 76 | 
             
              end
         | 
| 79 77 |  | 
| 80 | 
            -
              def to_xml(xml = Nokogiri::XML::Document.parse("<fields />")) #:nodoc:
         | 
| 81 | 
            -
                if xml.instance_of?(Nokogiri::XML::Builder)
         | 
| 82 | 
            -
                  xml_insertion_point = xml.doc.root 
         | 
| 83 | 
            -
                elsif xml.instance_of?(Nokogiri::XML::Document) 
         | 
| 84 | 
            -
                  xml_insertion_point = xml.root
         | 
| 85 | 
            -
                else
         | 
| 86 | 
            -
                  xml_insertion_point = xml
         | 
| 87 | 
            -
                end
         | 
| 88 | 
            -
                
         | 
| 89 | 
            -
                builder = Nokogiri::XML::Builder.with(xml_insertion_point) do |xml|
         | 
| 90 | 
            -
                  fields.each_pair do |field,field_info|
         | 
| 91 | 
            -
                    element_attrs = field_info[:element_attrs].nil? ? {} : field_info[:element_attrs]
         | 
| 92 | 
            -
                    values = field_info[:values]
         | 
| 93 | 
            -
                    values = [values] unless values.respond_to? :each
         | 
| 94 | 
            -
                    values.each do |val|
         | 
| 95 | 
            -
                      builder_arg = "xml.#{field}(val, element_attrs)"
         | 
| 96 | 
            -
                      eval(builder_arg)
         | 
| 97 | 
            -
                    end
         | 
| 98 | 
            -
                  end
         | 
| 99 | 
            -
                end
         | 
| 100 | 
            -
                return builder.to_xml
         | 
| 101 | 
            -
              end
         | 
| 102 78 |  | 
| 103 79 | 
             
            end
         | 
    
        data/lib/active_fedora/model.rb
    CHANGED
    
    | @@ -84,11 +84,18 @@ module ActiveFedora | |
| 84 84 |  | 
| 85 85 | 
             
                  # Returns a suitable uri object for :has_model
         | 
| 86 86 | 
             
                  # Should reverse Model#from_class_uri
         | 
| 87 | 
            -
                   | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
                     | 
| 91 | 
            -
             | 
| 87 | 
            +
                  def to_class_uri(attrs = {})
         | 
| 88 | 
            +
                    unless self.respond_to? :pid_suffix
         | 
| 89 | 
            +
                      pid_suffix = attrs.has_key?(:pid_suffix) ? attrs[:pid_suffix] : ContentModel::CMODEL_PID_SUFFIX
         | 
| 90 | 
            +
                    else
         | 
| 91 | 
            +
                      pid_suffix = self.pid_suffix
         | 
| 92 | 
            +
                    end
         | 
| 93 | 
            +
                    unless self.respond_to? :pid_namespace
         | 
| 94 | 
            +
                      namespace = attrs.has_key?(:namespace) ? attrs[:namespace] : ContentModel::CMODEL_NAMESPACE   
         | 
| 95 | 
            +
                    else
         | 
| 96 | 
            +
                      namespace = self.pid_namespace
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
                    "info:fedora/#{namespace}:#{ContentModel.sanitized_class_name(self)}#{pid_suffix}" 
         | 
| 92 99 | 
             
                  end
         | 
| 93 100 |  | 
| 94 101 | 
             
                  # Takes :all or a pid as arguments
         | 
| @@ -23,7 +23,7 @@ module ActiveFedora | |
| 23 23 | 
             
                # This can be overriden to assert a different model
         | 
| 24 24 | 
             
                # It's normally called once in the lifecycle, by #create#
         | 
| 25 25 | 
             
                def assert_content_model
         | 
| 26 | 
            -
                  add_relationship(:has_model,  | 
| 26 | 
            +
                  add_relationship(:has_model, self.class.to_class_uri)
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 29 |  | 
| @@ -46,7 +46,7 @@ module ActiveFedora | |
| 46 46 | 
             
                    #check has model and class match
         | 
| 47 47 | 
             
                    mod = relationships.first(:predicate=>Predicates.find_graph_predicate(:has_model))
         | 
| 48 48 | 
             
                    if mod
         | 
| 49 | 
            -
                      expected =  | 
| 49 | 
            +
                      expected = self.class.to_class_uri
         | 
| 50 50 | 
             
                      if mod.object.to_s == expected
         | 
| 51 51 | 
             
                        return true
         | 
| 52 52 | 
             
                      else
         | 
| @@ -18,7 +18,6 @@ namespace :af do | |
| 18 18 | 
             
                  puts "You must specify a valid pid.  Example: rake fedora:delete pid=demo:12"
         | 
| 19 19 | 
             
                else
         | 
| 20 20 | 
             
                  pid = ENV["pid"]
         | 
| 21 | 
            -
                  puts "Deleting '#{pid}' from #{ActiveFedora::RubydoraConnection.instance.options[:url]}"
         | 
| 22 21 | 
             
                  begin
         | 
| 23 22 | 
             
                    ActiveFedora::Base.load_instance(pid).delete
         | 
| 24 23 | 
             
                  rescue ActiveFedora::ObjectNotFoundError
         | 
| @@ -407,7 +407,7 @@ describe ActiveFedora::Base do | |
| 407 407 | 
             
                  @test_object5.testing_bidirectional_append(@test_object4)
         | 
| 408 408 | 
             
                  @test_object2.save
         | 
| 409 409 | 
             
                  @test_object5.save
         | 
| 410 | 
            -
                  model_rel =  | 
| 410 | 
            +
                  model_rel = MockAFBaseRelationship.to_class_uri
         | 
| 411 411 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 412 412 | 
             
                  @test_object2.object_relations[:has_model].should include model_rel
         | 
| 413 413 | 
             
                  @test_object2.object_relations[:has_part].should include @test_object3
         | 
| @@ -703,7 +703,7 @@ describe ActiveFedora::Base do | |
| 703 703 | 
             
            #       @test_object5.testing2_append(@test_object3)
         | 
| 704 704 | 
             
            #       @test_object2.save
         | 
| 705 705 | 
             
            #       @test_object5.save
         | 
| 706 | 
            -
            #       model_rel =  | 
| 706 | 
            +
            #       model_rel = MockAFBaseFromSolr.to_class_uri
         | 
| 707 707 | 
             
            #       #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 708 708 | 
             
            #       test_from_solr_object2 = MockAFBaseFromSolr.load_instance_from_solr(@test_object2.pid)
         | 
| 709 709 | 
             
            #       test_from_solr_object3 = MockAFBaseFromSolr.load_instance_from_solr(@test_object3.pid)
         | 
| @@ -9,15 +9,20 @@ include ActiveFedora::Model | |
| 9 9 | 
             
            include Mocha::API
         | 
| 10 10 |  | 
| 11 11 | 
             
            describe 'bugs' do
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 12 | 
            +
              before :all do
         | 
| 13 | 
            +
                class FooHistory < ActiveFedora::Base
         | 
| 14 | 
            +
                  has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"someData" do |m|
         | 
| 15 | 
            +
                    m.field "fubar", :string
         | 
| 16 | 
            +
                    m.field "swank", :text
         | 
| 17 | 
            +
                  end
         | 
| 18 | 
            +
                  has_metadata :type=>ActiveFedora::MetadataDatastream, :name=>"withText" do |m|
         | 
| 19 | 
            +
                    m.field "fubar", :text
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 16 22 | 
             
              end
         | 
| 17 | 
            -
               | 
| 18 | 
            -
                 | 
| 23 | 
            +
              after :all do
         | 
| 24 | 
            +
                Object.send(:remove_const, :FooHistory)
         | 
| 19 25 | 
             
              end
         | 
| 20 | 
            -
            end
         | 
| 21 26 |  | 
| 22 27 | 
             
              before(:each) do
         | 
| 23 28 | 
             
                @test_object = FooHistory.new
         | 
| @@ -113,7 +113,7 @@ describe ActiveFedora::RelsExtDatastream do | |
| 113 113 | 
             
                  @test_object5.testing2_append(@test_object3)
         | 
| 114 114 | 
             
                  @test_object2.save
         | 
| 115 115 | 
             
                  @test_object5.save
         | 
| 116 | 
            -
                  model_rel =  | 
| 116 | 
            +
                  model_rel = MockAFRelsSolr.to_class_uri
         | 
| 117 117 | 
             
                  #check inbound correct, testing goes to :has_part and testing2 goes to :has_member
         | 
| 118 118 | 
             
                  #get solr doc for @test_object2
         | 
| 119 119 | 
             
                  solr_doc = MockAFRelsSolr.find_by_solr(@test_object2.pid).hits.first
         | 
| @@ -59,15 +59,15 @@ describe ActiveFedora::SemanticNode do | |
| 59 59 | 
             
                class SpecialContainer; end;
         | 
| 60 60 | 
             
                class SpecialPart; end;
         | 
| 61 61 | 
             
                @special_container = ActiveFedora::Base.new()
         | 
| 62 | 
            -
                @special_container.add_relationship(:has_model,  | 
| 62 | 
            +
                @special_container.add_relationship(:has_model, SpecialContainer.to_class_uri)
         | 
| 63 63 | 
             
                @special_container.save
         | 
| 64 64 |  | 
| 65 65 | 
             
                @special_container3 = ActiveFedora::Base.new()
         | 
| 66 | 
            -
                @special_container3.add_relationship(:has_model,  | 
| 66 | 
            +
                @special_container3.add_relationship(:has_model, SpecialContainer.to_class_uri)
         | 
| 67 67 | 
             
                @special_container3.save
         | 
| 68 68 |  | 
| 69 69 | 
             
                @special_container4 = ActiveFedora::Base.new()
         | 
| 70 | 
            -
                @special_container4.add_relationship(:has_model,  | 
| 70 | 
            +
                @special_container4.add_relationship(:has_model, SpecialContainer.to_class_uri)
         | 
| 71 71 | 
             
                @special_container4.save
         | 
| 72 72 |  | 
| 73 73 | 
             
                #even though adding container3 and 3 special containers, it should only include the special containers when returning via relationship name finder methods
         | 
| @@ -80,7 +80,7 @@ describe ActiveFedora::SemanticNode do | |
| 80 80 | 
             
                @test_object_query.save
         | 
| 81 81 |  | 
| 82 82 | 
             
                @special_container2 = ActiveFedora::Base.new()
         | 
| 83 | 
            -
                @special_container2.add_relationship(:has_model,  | 
| 83 | 
            +
                @special_container2.add_relationship(:has_model, SpecialContainer.to_class_uri)
         | 
| 84 84 | 
             
                @special_container2.add_relationship(:has_member, 'info:fedora/'+@test_object_query.pid)
         | 
| 85 85 | 
             
                @special_container2.save
         | 
| 86 86 |  | 
| @@ -89,7 +89,7 @@ describe ActiveFedora::SemanticNode do | |
| 89 89 | 
             
                @part3.save
         | 
| 90 90 |  | 
| 91 91 | 
             
                @special_part = ActiveFedora::Base.new()
         | 
| 92 | 
            -
                @special_part.add_relationship(:has_model,  | 
| 92 | 
            +
                @special_part.add_relationship(:has_model, SpecialPart.to_class_uri)
         | 
| 93 93 | 
             
                @special_part.add_relationship(:is_part_of, @test_object_query)
         | 
| 94 94 | 
             
                @special_part.save
         | 
| 95 95 |  | 
| @@ -442,7 +442,7 @@ describe ActiveFedora::SemanticNode do | |
| 442 442 |  | 
| 443 443 | 
             
                it 'should automatically update the relationships_by_name if relationships has changed (no refresh of relationships_by_name hash unless relationships hash has changed' do
         | 
| 444 444 | 
             
                  @test_object2 = MockSemNamedRelationships.new
         | 
| 445 | 
            -
                  @test_object2.add_relationship(:has_model,  | 
| 445 | 
            +
                  @test_object2.add_relationship(:has_model, MockSemNamedRelationships.to_class_uri)
         | 
| 446 446 | 
             
                  #should return expected named relationships
         | 
| 447 447 | 
             
                  @test_object2.relationships_by_name.should == {:self=>{"testing"=>[],"testing2"=>[], "collection_members"=>[], "part_of"=>[], "parts_outbound"=>[]}}
         | 
| 448 448 | 
             
                  @test_object2.add_relationship(:has_part, @test_object.internal_uri)
         | 
| @@ -1,7 +1,5 @@ | |
| 1 1 | 
             
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 | 
            -
            # Some tentative extensions to ActiveFedora::Base
         | 
| 4 | 
            -
             | 
| 5 3 | 
             
            describe ActiveFedora::Base do
         | 
| 6 4 |  | 
| 7 5 | 
             
              before(:each) do
         | 
| @@ -11,9 +9,6 @@ describe ActiveFedora::Base do | |
| 11 9 | 
             
              end
         | 
| 12 10 |  | 
| 13 11 | 
             
              describe ".file_objects" do
         | 
| 14 | 
            -
                it "should be a supported method" do
         | 
| 15 | 
            -
                  @base.should respond_to("file_objects")
         | 
| 16 | 
            -
                end
         | 
| 17 12 | 
             
                it "should wrap .collection_members and .parts" do
         | 
| 18 13 | 
             
                  @base.expects(:collection_members).returns([])
         | 
| 19 14 | 
             
                  @base.expects(:parts).returns(["Foo"])
         | 
    
        data/spec/unit/base_spec.rb
    CHANGED
    
    | @@ -831,8 +831,8 @@ describe ActiveFedora::Base do | |
| 831 831 | 
             
                  ActiveFedora::RubydoraConnection.instance.stubs(:nextid).returns(next_pid)
         | 
| 832 832 | 
             
                  stub_get(next_pid)
         | 
| 833 833 | 
             
                  @test_object2 = MockNamedRelationships.new
         | 
| 834 | 
            -
                  @test_object2.add_relationship(:has_model,  | 
| 835 | 
            -
                  @test_object.add_relationship(:has_model, ActiveFedora:: | 
| 834 | 
            +
                  @test_object2.add_relationship(:has_model, MockNamedRelationships.to_class_uri)
         | 
| 835 | 
            +
                  @test_object.add_relationship(:has_model, ActiveFedora::Base.to_class_uri)
         | 
| 836 836 | 
             
                  #should return expected named relationships
         | 
| 837 837 | 
             
                  @test_object2.relationships_by_name
         | 
| 838 838 | 
             
                  @test_object2.relationships_by_name[:self]["testing"].should == []
         | 
| @@ -865,7 +865,7 @@ describe ActiveFedora::Base do | |
| 865 865 | 
             
                  @test_object2.should respond_to(:testing_append)
         | 
| 866 866 | 
             
                  @test_object2.should respond_to(:testing_remove)
         | 
| 867 867 | 
             
                  #test executing each one to make sure code added is correct
         | 
| 868 | 
            -
                  model_pid = | 
| 868 | 
            +
                  model_pid =ActiveFedora::Base.to_class_uri
         | 
| 869 869 | 
             
                  @test_object.add_relationship(:has_model,model_pid)
         | 
| 870 870 | 
             
                  @test_object2.add_relationship(:has_model,model_pid)
         | 
| 871 871 | 
             
                  @test_object2.testing_append(@test_object)
         | 
| @@ -51,14 +51,15 @@ describe ActiveFedora::ContentModel do | |
| 51 51 | 
             
                @test_cmodel.should respond_to(:pid_suffix=)
         | 
| 52 52 | 
             
              end
         | 
| 53 53 |  | 
| 54 | 
            -
              it 'should provide #pid_from_ruby_class' do
         | 
| 55 | 
            -
                ActiveFedora::ContentModel.should respond_to(:pid_from_ruby_class)
         | 
| 56 | 
            -
              end
         | 
| 57 54 |  | 
| 58 55 | 
             
              describe "#pid_from_ruby_class" do
         | 
| 56 | 
            +
                before do
         | 
| 57 | 
            +
                  ActiveSupport::Deprecation.stubs(:warn)
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
              
         | 
| 59 60 | 
             
                it "should construct pids" do
         | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 61 | 
            +
                  ActiveFedora::ContentModel.pid_from_ruby_class(@test_cmodel.class).should == "info:fedora/afmodel:ActiveFedora_ContentModel"
         | 
| 62 | 
            +
                  ActiveFedora::ContentModel.pid_from_ruby_class(@test_cmodel.class, :namespace => "foo", :pid_suffix => "BarBar").should == "info:fedora/foo:ActiveFedora_ContentModelBarBar"
         | 
| 62 63 | 
             
                end
         | 
| 63 64 | 
             
                it "should construct pids with the namespace declared in the model" do
         | 
| 64 65 | 
             
                  ActiveFedora::ContentModel.stubs(:pid_namespace).returns("test-cModel")
         | 
| @@ -114,7 +114,7 @@ describe ActiveFedora::Relationships do | |
| 114 114 | 
             
                      @test_object2.pid = increment_pid
         | 
| 115 115 | 
             
                      @test_object2.stubs(:testing_inbound).returns({})
         | 
| 116 116 | 
             
                      @test_object2.expects(:rels_ext).returns(stub("rels_ext", :dirty= => true, :content =>'')).at_least_once
         | 
| 117 | 
            -
                      @test_object2.add_relationship(:has_model,  | 
| 117 | 
            +
                      @test_object2.add_relationship(:has_model, SpecNode.to_class_uri)
         | 
| 118 118 | 
             
                      @test_object2.should respond_to(:testing_append)
         | 
| 119 119 | 
             
                      @test_object2.should respond_to(:testing_remove)
         | 
| 120 120 | 
             
                      @test_object2.should respond_to(:testing2_append)
         | 
| @@ -353,7 +353,7 @@ describe ActiveFedora::Relationships do | |
| 353 353 | 
             
                    @local_node.pid = "mypid1"
         | 
| 354 354 | 
             
                    @local_node2 = SpecNode.new
         | 
| 355 355 | 
             
                    @local_node2.pid = "mypid2"
         | 
| 356 | 
            -
                    model_def =  | 
| 356 | 
            +
                    model_def = SpecNode.to_class_uri
         | 
| 357 357 | 
             
                    @local_node.expects(:rels_ext).returns(stub("rels_ext", :dirty= => true, :content=>'')).at_least_once
         | 
| 358 358 | 
             
                    @local_node.add_relationship(:has_model, model_def)
         | 
| 359 359 | 
             
                    @local_node2.expects(:rels_ext).returns(stub("rels_ext", :dirty= => true, :content=>'')).at_least_once
         | 
| @@ -428,7 +428,7 @@ describe ActiveFedora::Relationships do | |
| 428 428 | 
             
                  #add relationships that mirror 'testing' and 'testing2'
         | 
| 429 429 | 
             
                  graph = RDF::Graph.new
         | 
| 430 430 | 
             
                  subject = RDF::URI.new "info:fedora/test:sample_pid"
         | 
| 431 | 
            -
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new( | 
| 431 | 
            +
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new(MockRelationshipNames.to_class_uri))
         | 
| 432 432 | 
             
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_member),  RDF::URI.new(@test_object4.internal_uri))
         | 
| 433 433 | 
             
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_part),  RDF::URI.new(@test_object3.internal_uri))
         | 
| 434 434 | 
             
                  @test_object2.expects(:relationships).returns(graph).at_least_once
         | 
| @@ -518,7 +518,7 @@ describe ActiveFedora::Relationships do | |
| 518 518 | 
             
                  #has_model relationship does not get created until save called
         | 
| 519 519 | 
             
                  graph = RDF::Graph.new
         | 
| 520 520 | 
             
                  subject = RDF::URI.new "info:fedora/test:sample_pid"
         | 
| 521 | 
            -
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new( | 
| 521 | 
            +
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new(SpecNode.to_class_uri))
         | 
| 522 522 | 
             
                  @test_object.expects(:relationships).returns(graph).at_least_once
         | 
| 523 523 | 
             
                  @test_object.conforms_to?(SpecNode).should == true
         | 
| 524 524 | 
             
                end
         | 
| @@ -538,7 +538,7 @@ describe ActiveFedora::Relationships do | |
| 538 538 | 
             
                  #has_model relationship does not get created until save called so need to add the has model rel here, is fine since not testing save
         | 
| 539 539 | 
             
                  graph = RDF::Graph.new
         | 
| 540 540 | 
             
                  subject = RDF::URI.new "info:fedora/test:sample_pid"
         | 
| 541 | 
            -
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new( | 
| 541 | 
            +
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new(SpecNode.to_class_uri))
         | 
| 542 542 | 
             
                  @test_object.expects(:relationships).returns(graph).at_least_once
         | 
| 543 543 | 
             
                  @test_object3.assert_conforms_to('object',@test_object,SpecNode)
         | 
| 544 544 | 
             
                end
         | 
| @@ -581,7 +581,7 @@ describe ActiveFedora::Relationships do | |
| 581 581 | 
             
                  @test_object2.pid = increment_pid
         | 
| 582 582 | 
             
                  @test_object3 = MockNamedRelationships3.new
         | 
| 583 583 | 
             
                  @test_object3.pid = increment_pid
         | 
| 584 | 
            -
                  model_pid =  | 
| 584 | 
            +
                  model_pid = MockNamedRelationships3.to_class_uri
         | 
| 585 585 | 
             
                  graph = RDF::Graph.new
         | 
| 586 586 | 
             
                  subject = RDF::URI.new "info:fedora/test:sample_pid"
         | 
| 587 587 | 
             
                  graph.insert RDF::Statement.new(subject, ActiveFedora::Predicates.find_graph_predicate(:has_model),  RDF::URI.new(model_pid))
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: active-fedora
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 5 | 
            -
              prerelease:  | 
| 4 | 
            +
              hash: 15
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 3
         | 
| 8 8 | 
             
              - 2
         | 
| 9 9 | 
             
              - 0
         | 
| 10 | 
            -
               | 
| 11 | 
            -
              - 7
         | 
| 12 | 
            -
              version: 3.2.0.pre7
         | 
| 10 | 
            +
              version: 3.2.0
         | 
| 13 11 | 
             
            platform: ruby
         | 
| 14 12 | 
             
            authors: 
         | 
| 15 13 | 
             
            - Matt Zumwalt
         | 
| @@ -19,7 +17,7 @@ autorequire: | |
| 19 17 | 
             
            bindir: bin
         | 
| 20 18 | 
             
            cert_chain: []
         | 
| 21 19 |  | 
| 22 | 
            -
            date: 2012-01- | 
| 20 | 
            +
            date: 2012-01-09 00:00:00 -06:00
         | 
| 23 21 | 
             
            default_executable: 
         | 
| 24 22 | 
             
            dependencies: 
         | 
| 25 23 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -745,14 +743,12 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 745 743 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 746 744 | 
             
              none: false
         | 
| 747 745 | 
             
              requirements: 
         | 
| 748 | 
            -
              - - " | 
| 746 | 
            +
              - - ">="
         | 
| 749 747 | 
             
                - !ruby/object:Gem::Version 
         | 
| 750 | 
            -
                  hash:  | 
| 748 | 
            +
                  hash: 3
         | 
| 751 749 | 
             
                  segments: 
         | 
| 752 | 
            -
                  -  | 
| 753 | 
            -
                   | 
| 754 | 
            -
                  - 1
         | 
| 755 | 
            -
                  version: 1.3.1
         | 
| 750 | 
            +
                  - 0
         | 
| 751 | 
            +
                  version: "0"
         | 
| 756 752 | 
             
            requirements: []
         | 
| 757 753 |  | 
| 758 754 | 
             
            rubyforge_project: rubyfedora
         |