source: ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/item_single_spec.rb@ 339

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

data_structure will nearly completed

File size: 927 bytes
Line 
1require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
3include OpenEHR::RM::DataStructures::ItemStructure
4include OpenEHR::RM::DataStructures::ItemStructure::Representation
5include OpenEHR::RM::DataTypes::Text
6
7describe ItemSingle do
8 before(:each) do
9 element = stub(Element, :archetype_node_id => 'at0002')
10 item_single_name = DvText.new(:value => 'item single')
11 @item_single = ItemSingle.new(:name => item_single_name,
12 :archetype_node_id => 'at0001',
13 :item => element)
14 end
15
16 it 'should be an instance of ItemSingle' do
17 @item_single.should be_an_instance_of ItemSingle
18 end
19
20 it 'should raise ArgumentError with nil item' do
21 lambda {
22 @item_single.item = nil
23 }.should raise_error ArgumentError
24 end
25
26 it 'should return as_hierarchy' do
27 @item_single.as_hierarchy.archetype_node_id.should == 'at0002'
28 end
29end
Note: See TracBrowser for help on using the repository browser.