Sha256: 0bd0cf5f0d4c7fe043f474fa95e22ca37f9cae60444b6c834b428cc6c0a91a04

Contents?: true

Size: 1.75 KB

Versions: 26

Compression:

Stored size: 1.75 KB

Contents

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

describe Role do
  before(:each) do
    name = DvText.new(:value => 'role')
    uid = HierObjectID.new(:value => '01')
    identities = stub(Set, :empty? => false)
    capabilities = stub(Array, :size => 2, :empty? => false)
    lower = DvDate.new(:value => '2009-11-21')
    time_validity = stub(DvInterval, :lower => lower)
    performer = stub(PartyRef, :type => 'ROLE')
    @role = Role.new(:archetype_node_id => 'at0000',
                     :name => name,
                     :uid => uid,
                     :identities => identities,
                     :performer => performer,
                     :capabilities => capabilities,
                     :time_validity => time_validity)
  end

  it 'should be an instance of Role' do
    @role.should be_an_instance_of Role
  end

  it 'performer should assigned properly' do
    @role.performer.type.should == 'ROLE'
  end

  it 'should raise ArgumentError with nil performer' do
    lambda {
      @role.performer = nil
    }.should raise_error ArgumentError
  end

  it 'capabilities should be assigned properly' do
    @role.capabilities.size.should be_equal 2
  end

  it 'should raise ArgumentError with empty capabilities' do
    lambda {
      @role.capabilities = [ ]
    }.should raise_error ArgumentError
  end

  it 'should not raise ArgumentError with nil capabilities' do
    lambda {
      @role.capabilities = nil
    }.should_not raise_error ArgumentError
  end

  it 'time_validity should be properly assigned' do
    @role.time_validity.lower.value.should == '2009-11-21'
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

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