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
open_ehr-0.9.4 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-0.9.3 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-0.9.2 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-0.9.1 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-0.9.0 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb
open_ehr-0.6.1 spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb