Sha256: 75650d39befed57a25b4d4538d9d52a70903786c77d25c94cd483177ef428f9f

Contents?: true

Size: 1.99 KB

Versions: 23

Compression:

Stored size: 1.99 KB

Contents

require File.join( File.dirname(__FILE__), "../spec_helper" )

require 'active_fedora'
require "rexml/document"
require 'ftools'

describe ActiveFedora::Datastream do
  
  before(:each) do
    @test_object = ActiveFedora::Base.new
    @test_datastream = ActiveFedora::Datastream.new(@test_object.inner_object, 'abcd')
    @test_datastream.content = 'hi there'
  end
  
  it "should provide #last_modified_in_repository" do
    pending
    @test_datastream.should respond_to(:last_modified_in_repository)
  end
  
  it 'should update @last_modified when #save or #content is called' do 
    pending
    # ActiveFedora::Repository.any_instance.stubs(:save)
    # ActiveFedora::Repository.any_instance.stubs(:fetch_custom)
    @test_datastream.expects(:last_modified=).times(2)
    @test_datastream.expects(:last_modified_in_repository).times(3)
    @test_datastream.save
    @test_datastream.content
  end
  
  describe '#save' do
    it 'should not save to fedora if @last_modified does not match the datetime from fedora'
    it 'should save to fedora if @last_modified matches the datetime from fedora'
  end
  
  describe '#last_modified_in_repository' do
      it "should retrieve a datetime from fedora"
  end
  
  it 'should provide #check_concurrency' do
    @test_datastream.should respond_to(:check_concurrency)
  end
  
  describe '#check_concurrency' do
    it 'should return true if @last_modified matches the datetime from fedora' do
      pending
      @test_datastream.expects(:last_modified_in_repository).returns("2008-10-17T00:17:18.194Z")
      @test_datastream.last_modified = "2008-10-17T00:17:18.194Z"
      @test_datastream.check_concurrency.should == true
    end
    
    it 'should raise an error if @last_modified does not match the datetime from fedora' do
      pending
      @test_datastream.expects(:last_modified_in_repository).returns("blah blah blah")
      @test_datastream.last_modified = "2008-10-17T00:17:18.194Z"
      @test_datastream.check_concurrency.should raise_error()
    end
    
  end
  
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
active-fedora-3.1.4 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.3 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.2 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.1 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.rc4 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.rc3 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.rc2 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.rc1 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre14 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre13 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre12 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre11 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre10 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre9 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre8 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre7 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre6 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre5 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.0.pre4 spec/unit/datastream_concurrency_spec.rb