Sha256: 9ee60865321b1271327df5660e4999d20a14ca526adb227c1f852cff138325e7

Contents?: true

Size: 1.73 KB

Versions: 68

Compression:

Stored size: 1.73 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::OmDatastream
      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::OmDatastream, :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

68 entries across 68 versions & 1 rubygems

Version Path
active-fedora-6.7.5 spec/unit/solr_digital_object_spec.rb
active-fedora-6.7.4 spec/unit/solr_digital_object_spec.rb
active-fedora-7.0.0.pre1 spec/unit/solr_digital_object_spec.rb
active-fedora-6.7.3 spec/unit/solr_digital_object_spec.rb
active-fedora-6.7.2 spec/unit/solr_digital_object_spec.rb
active-fedora-6.7.1 spec/unit/solr_digital_object_spec.rb
active-fedora-6.7.0 spec/unit/solr_digital_object_spec.rb
active-fedora-6.7.0.rc1 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.1 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0 spec/unit/solr_digital_object_spec.rb
active-fedora-5.7.1 spec/unit/solr_digital_object_spec.rb
active-fedora-5.7.0 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.rc5 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.rc4 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.rc3 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.rc2 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.rc1 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.pre4 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.pre3 spec/unit/solr_digital_object_spec.rb
active-fedora-6.6.0.pre2 spec/unit/solr_digital_object_spec.rb