Sha256: ec2c6f38d5a0656bbccde9094f318165ba14fdf8d533d2239b8560e365896e9d

Contents?: true

Size: 1.62 KB

Versions: 26

Compression:

Stored size: 1.62 KB

Contents

require File.dirname(__FILE__) + '/../../../../../spec_helper'
include OpenEHR::RM::Common::ChangeControl
include OpenEHR::RM::DataTypes::Text

describe Contribution do
  before(:each) do
    uid = HierObjectID.new(:value => 'ABC::DEF::2')
    versions = stub(Set, :size => 2, :empty? => false)
    description = DvText.new(:value => 'test')
    audit = stub(AuditDetails, :empty? => false, :description => description)
    @contribution = Contribution.new(:uid => uid,
                                     :versions => versions,
                                     :audit => audit)
  end

  it 'should be an instance of Contribution' do
    @contribution.should be_an_instance_of Contribution
  end

  it 'uid.value should be ABC::DEF::2' do
    @contribution.uid.value.should == 'ABC::DEF::2'
  end

  it 'audit.description should test' do
    @contribution.audit.description.value.should == 'test'
  end

  it 'versions size should be 2' do
    @contribution.versions.size.should == 2
  end

  it 'should raise ArgumentError when version is empty' do
    lambda {
      @contribution.versions = Set.new
    }.should raise_error ArgumentError
  end

  it 'should raise ArgumentError when uid is nil' do
    lambda {
      @contribution.uid = nil
    }.should raise_error ArgumentError
  end

  it 'should raise ArgumentError audit is nil' do
    lambda {
      @contribution.audit = nil
    }.should raise_error ArgumentError
  end

  it 'shoudl raise ArgumentError audit.description is empty' do
    nil_audit = stub(AuditDetails, :description => nil)
    lambda {
      @contribution.audit = nil_audit
    }.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/change_control/contribution_spec.rb
openehr-1.2.7 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.6 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.5 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.4 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.3 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.2 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.1 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.2.0 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.6 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.5 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.4 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.3 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.2 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.1 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
openehr-1.1.0 spec/lib/openehr/rm/common/change_control/contribution_spec.rb
open_ehr-1.0.2 spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb
open_ehr-1.0.1 spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb
open_ehr-1.0.0 spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb
open_ehr-0.9.5 spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb