Sha256: d633ec35b46d500da3207b4d27ea2f2039a698c1cd75c016fd8443ac802323bd

Contents?: true

Size: 1.53 KB

Versions: 26

Compression:

Stored size: 1.53 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::RM::Common::Generic
include OpenEHR::RM::Support::Identification
include OpenEHR::RM::DataTypes::Quantity::DateTime

describe RevisionHistory do
  before(:each) do
    version_id = stub(ObjectVersionID, :value => 'ABCD::EFGH::1')
    committed_time = stub(DvDateTime, :value => '2009-11-02T22:19:34')
    audit = stub(AuditDetails, :time_committed => committed_time)
    audits = stub(Array, :first => audit)
    last_item = stub(RevisionHistoryItem, :version_id => version_id,
                     :audits => audits)
    items = stub(Array, :size => 128, :empty? => false, :last => last_item)
    @revision_history = RevisionHistory.new(:items => items)
  end

  it 'should be an instance of RevisionHistory' do
    @revision_history.should be_an_instance_of RevisionHistory
  end

  it 'items size should return size 128' do
    @revision_history.items.size.should be_equal 128
  end

  it 'should return the most recent version string' do
    @revision_history.most_recent_version.should == 'ABCD::EFGH::1'
  end

  it 'should return the most recent commited version time string' do
    @revision_history.most_recent_version_time_committed == '2009-11-02T22:19:34'
  end

  it 'should raise ArgumentError when item is nil' do
    lambda {
      @revision_history.items = nil
    }.should raise_error ArgumentError
  end

  it 'should raise ArgumentError when item is empty' do
    lambda {
      @revision_history.items = Array.new
    }.should raise_error ArgumentError
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
openehr-1.2.8 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.7 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.6 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.5 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.4 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.3 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.2 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.1 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.2.0 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.6 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.5 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.4 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.3 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.2 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.1 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
openehr-1.1.0 spec/lib/openehr/rm/common/generic/revision_history_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-0.9.5 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb