Changeset 369 for ruby/trunk/spec


Ignore:
Timestamp:
Nov 20, 2009, 3:11:04 PM (14 years ago)
Author:
KOBAYASHI, Shinji
Message:

merge from branches/0.5

Location:
ruby/trunk
Files:
5 edited
79 copied

Legend:

Unmodified
Added
Removed
  • ruby/trunk

  • ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_list_spec.rb

    r220 r369  
    3636  end
    3737
    38   it 'retrieve the item with a name' do
     38  it 'should return the item with a name' do
    3939    @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
    4044  end
    4145
  • ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_single_spec.rb

    r216 r369  
    66
    77describe 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')
    1411    @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)
    1814  end
    1915
     16  it 'should be an instance of ItemSingle' do
     17    @item_single.should be_an_instance_of ItemSingle
     18  end
    2019
     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
    2129end
  • ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb

    r220 r369  
    4545  end
    4646
     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
    4751
    4852  it 's row_names should be cluster cluster' do
     
    96100  end
    97101
     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
    98106  it 'second row should be named_row four' do
    99107    @item_table.named_row('four').items[1].name.value = 'five'
     
    126134
    127135  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
    129142  end
    130143
  • ruby/trunk/spec/lib/open_ehr/rm/data_structures/item_structure/item_tree_spec.rb

    r220 r369  
    77describe ItemTree do
    88  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
    1012      Element.new(:name => DvText.new(:value => name),
    11                   :archetype_node_id => 'test')
     13                  :archetype_node_id => 'at000' + i.to_s)
    1214    end
    1315    name = DvText.new(:value => 'item tree')
    1416    @item_tree = ItemTree.new(:name => name,
    15                               :archetype_node_id => 'test',
     17                              :archetype_node_id => 'at0001',
    1618                              :items => items)
    1719  end
     
    2628
    2729  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'
    2847  end
    2948end
Note: See TracChangeset for help on using the changeset viewer.