Sha256: 59721befd53c09032a77a8c75b7789677644f4e9ef01ef5bf489bbb5b7587160

Contents?: true

Size: 1.75 KB

Versions: 23

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'

describe ActiveFedora::SolrDigitalObject do
  describe "repository" do
    subject { ActiveFedora::SolrDigitalObject.new({},{'datastreams'=>{}}) }
    describe "when not finished" do
      it "should not respond_to? :repository" do
        subject.should_not respond_to :repository
      end
    end
    describe "when finished" do
      before do
        subject.freeze
      end
      it "should respond_to? :repository" do
        subject.should respond_to :repository
      end
    end
  end

  describe "initializing" do
    describe "without a datastream in the ds spec and an xml mime type in the solr doc" do
      before do
        class WithoutMetadataDs < ActiveFedora::Base
          ## No datastreams are defined in this class
        end
      end
      after do
        Object.send(:remove_const, :WithoutMetadataDs)
      end
      subject { ActiveFedora::SolrDigitalObject.new({}, {'datastreams'=>{'properties'=>{'dsMIME'=>'text/xml'}}},WithoutMetadataDs) }
      it "should create an xml datastream" do
        subject.datastreams['properties'].should be_kind_of ActiveFedora::NokogiriDatastream
      end
    end
    
    describe "with a ds spec that's not part of the solrized object" do
      before do
        class MissingMetadataDs < ActiveFedora::Base
          has_metadata :name => "foo", :type => ActiveFedora::NokogiriDatastream, :label => 'Foo Data'
        end
        after do
          Object.send(:remove_const, MissingMetadataDs)
        end
        subject { ActiveFedora::SolrDigitalObject.new({}, {'datastreams'=>{'properties'=>{'dsMIME'=>'text/xml'}}},MissingMetadataDs) }
        it "should have a foo datastream" do
          subject.datastreams['foo'].label.should == 'Foo Data'
        end
      end
    end
  end


end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
active-fedora-5.2.0 spec/unit/solr_digital_object_spec.rb
active-fedora-5.1.0 spec/unit/solr_digital_object_spec.rb
active-fedora-5.0.0 spec/unit/solr_digital_object_spec.rb
active-fedora-5.0.0.rc5 spec/unit/solr_digital_object_spec.rb
active-fedora-5.0.0.rc4 spec/unit/solr_digital_object_spec.rb
active-fedora-5.0.0.rc3 spec/unit/solr_digital_object_spec.rb
active-fedora-5.0.0.rc2 spec/unit/solr_digital_object_spec.rb
active-fedora-5.0.0.rc1 spec/unit/solr_digital_object_spec.rb
active-fedora-4.6.0.rc4 spec/unit/solr_digital_object_spec.rb
active-fedora-4.6.0.rc3 spec/unit/solr_digital_object_spec.rb
active-fedora-4.6.0.rc2 spec/unit/solr_digital_object_spec.rb
active-fedora-4.6.0.rc1 spec/unit/solr_digital_object_spec.rb
active-fedora-4.5.3 spec/unit/solr_digital_object_spec.rb
active-fedora-4.5.2 spec/unit/solr_digital_object_spec.rb
active-fedora-4.5.1 spec/unit/solr_digital_object_spec.rb
active-fedora-4.5.0 spec/unit/solr_digital_object_spec.rb
active-fedora-4.4.1 spec/unit/solr_digital_object_spec.rb
active-fedora-4.4.0 spec/unit/solr_digital_object_spec.rb
active-fedora-4.3.0 spec/unit/solr_digital_object_spec.rb
active-fedora-4.2.0 spec/unit/solr_digital_object_spec.rb