source: ruby/trunk/spec/lib/open_ehr/rm/demographic/capability_spec.rb@ 369

Last change on this file since 369 was 369, checked in by KOBAYASHI, Shinji, 14 years ago

merge from branches/0.5

File size: 1.3 KB
Line 
1require File.dirname(__FILE__) + '/../../../../spec_helper'
2include OpenEHR::RM::Demographic
3include OpenEHR::RM::DataTypes::Text
4include OpenEHR::RM::DataTypes::Quantity::DateTime
5include OpenEHR::RM::Support::Identification
6include OpenEHR::RM::DataStructures::ItemStructure
7
8describe Capability do
9 before(:each) do
10 name = DvText.new(:value => 'party relation')
11 credentials = stub(ItemStructure, :archetype_node_id => 'at0001')
12 lower = DvDate.new(:value => '2009-11-21')
13 time_validity = stub(DvInterval, :lower => lower)
14 @capability = Capability.new(:archetype_node_id => 'at0000',
15 :name => name,
16 :credentials => credentials,
17 :time_validity => time_validity)
18 end
19
20 it 'should be an instance of Capability' do
21 @capability.should be_an_instance_of Capability
22 end
23
24 it 'credential should be assigned properly' do
25 @capability.credentials.archetype_node_id.should == 'at0001'
26 end
27
28 it 'should raise ArgumentError when nil assigned to credentials' do
29 lambda {
30 @capability.credentials = nil
31 }.should raise_error ArgumentError
32 end
33
34 it 'time_validity should be assigned properly' do
35 @capability.time_validity.lower.value.should == '2009-11-21'
36 end
37end
Note: See TracBrowser for help on using the repository browser.