Sha256: 09e6e0db7b495da5ff00e8393a3c702daa471b158e818030378698886b7af15e

Contents?: true

Size: 1.18 KB

Versions: 11

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe ActiveFedora::RDFDatastream do
  describe "a new instance" do
    its(:metadata?) { should be_true}
    its(:content_changed?) { should be_false}
  end
  describe "an instance that exists in the datastore, but hasn't been loaded" do
    before do 
      class MyDatastream < ActiveFedora::NtriplesRDFDatastream
        map_predicates do |map|
          map.title(:in => RDF::DC)
        end
      end
      class MyObj < ActiveFedora::Base
        has_metadata 'descMetadata', type: MyDatastream
      end
      @obj = MyObj.new
      @obj.descMetadata.title = 'Foobar'
      @obj.save
    end
    after do
      @obj.destroy
      Object.send(:remove_const, :MyDatastream)
      Object.send(:remove_const, :MyObj)
    end
    subject { @obj.reload.descMetadata } 
    it "should not load the descMetadata datastream when calling content_changed?" do
      @obj.inner_object.repository.should_not_receive(:datastream_dissemination).with(hash_including(:dsid=>'descMetadata'))
      subject.should_not be_content_changed
    end

    it "should allow asserting an empty string" do
      @obj.descMetadata.title = ['']
      @obj.descMetadata.title.should == ['']
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active-fedora-6.4.0.rc2 spec/unit/rdf_datastream_spec.rb
active-fedora-6.4.0.rc1 spec/unit/rdf_datastream_spec.rb
active-fedora-6.3.0 spec/unit/rdf_datastream_spec.rb
active-fedora-6.2.0 spec/unit/rdf_datastream_spec.rb
active-fedora-6.1.1 spec/unit/rdf_datastream_spec.rb
active-fedora-6.1.0 spec/unit/rdf_datastream_spec.rb
active-fedora-6.0.0 spec/unit/rdf_datastream_spec.rb
active-fedora-6.0.0.rc7 spec/unit/rdf_datastream_spec.rb
active-fedora-6.0.0.rc6 spec/unit/rdf_datastream_spec.rb
active-fedora-6.0.0.rc5 spec/unit/rdf_datastream_spec.rb
active-fedora-6.0.0.rc4 spec/unit/rdf_datastream_spec.rb