Sha256: aefeb87650b4c39041934890c1a6b32b96f8e57e419d9a7c9c65fbed31cb4d56

Contents?: true

Size: 1.94 KB

Versions: 22

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'

require 'active_fedora'
require "rexml/document"

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

22 entries across 22 versions & 1 rubygems

Version Path
active-fedora-4.0.0.rc8 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc7 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc6 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc5 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc4 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc3 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc2 spec/unit/datastream_concurrency_spec.rb
active-fedora-4.0.0.rc1 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.3.2 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.3.1 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.3.0 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.2 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.1.6 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0.pre7 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0.pre6 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0.pre5 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0.pre4 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0.pre3 spec/unit/datastream_concurrency_spec.rb
active-fedora-3.2.0.pre2 spec/unit/datastream_concurrency_spec.rb