Changeset 369 for ruby/trunk/spec/lib/open_ehr/rm
- Timestamp:
- Nov 20, 2009, 3:11:04 PM (15 years ago)
- Location:
- ruby/trunk
- Files:
-
- 5 edited
- 79 copied
Legend:
- Unmodified
- Added
- Removed
-
ruby/trunk
- Property svn:mergeinfo changed
/ruby/branches/0.5 merged: 292,296,300-301,305,308-312,322,330-365
- Property svn:mergeinfo changed
-
ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_list_spec.rb
r220 r369 36 36 end 37 37 38 it ' retrievethe item with a name' do38 it 'should return the item with a name' do 39 39 @item_list.named_item('one').name.value.should == 'one' 40 end 41 42 it 'should return nil when item is not exist' do 43 @item_list.named_item('four').should be_nil 40 44 end 41 45 -
ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_single_spec.rb
r216 r369 6 6 7 7 describe ItemSingle do 8 before(:all) do 9 name = 10 @element = Element.new(:name => DvText.new('item'), 11 :archetype_node_id => 'AT0000', 12 :value => DvQuantity.new()) 13 item_single_name = DvText.new('item single') 8 before(:each) do 9 element = stub(Element, :archetype_node_id => 'at0002') 10 item_single_name = DvText.new(:value => 'item single') 14 11 @item_single = ItemSingle.new(:name => item_single_name, 15 :archetype_node_id => 'test', 16 :item => @element) 17 12 :archetype_node_id => 'at0001', 13 :item => element) 18 14 end 19 15 16 it 'should be an instance of ItemSingle' do 17 @item_single.should be_an_instance_of ItemSingle 18 end 20 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 21 29 end -
ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb
r220 r369 45 45 end 46 46 47 it 'column_count should be 0 when @rows == nil' do 48 @item_table.rows = nil 49 @item_table.column_count.should be_equal 0 50 end 47 51 48 52 it 's row_names should be cluster cluster' do … … 96 100 end 97 101 102 it 'should be false it has_column with name ten' do 103 @item_table.has_column_with_name?('ten').should be_false 104 end 105 98 106 it 'second row should be named_row four' do 99 107 @item_table.named_row('four').items[1].name.value = 'five' … … 126 134 127 135 it 'should be two element at named cell by row column' do 128 @item_table.element_at_named_cell('cluster', 'two').name.value == 'two' 136 @item_table.element_at_named_cell('cluster', 'three').name.value == 'three' 137 end 138 139 it 'should return nil when rows are nil' do 140 @item_table.rows = nil 141 @item_table.row_count.should be_equal 0 129 142 end 130 143 -
ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_tree_spec.rb
r220 r369 7 7 describe ItemTree do 8 8 before(:each) do 9 items = %w{one two}.collect do |name| 9 i = 1 10 items = %w{one two three}.collect do |name| 11 i += 1 10 12 Element.new(:name => DvText.new(:value => name), 11 :archetype_node_id => ' test')13 :archetype_node_id => 'at000' + i.to_s) 12 14 end 13 15 name = DvText.new(:value => 'item tree') 14 16 @item_tree = ItemTree.new(:name => name, 15 :archetype_node_id => ' test',17 :archetype_node_id => 'at0001', 16 18 :items => items) 17 19 end … … 26 28 27 29 it 'has valid element path' do 30 @item_tree.has_element_path?('at0002').should be_true 31 end 32 33 it 'should return false with wrong node' do 34 @item_tree.has_element_path?('at0005').should be_false 35 end 36 37 it 'path at002 should return two' do 38 @item_tree.element_at_path('at0003').name.value.should == 'two' 39 end 40 41 it 'path at005 should return nil' do 42 @item_tree.element_at_path('at0005').should be_nil 43 end 44 45 it 'should returns ItemTree as Cluster' do 46 @item_tree.as_hierarchy.name.value.should == 'item tree' 28 47 end 29 48 end
Note:
See TracChangeset
for help on using the changeset viewer.