require File.dirname(__FILE__) + '/../../../../../spec_helper' include OpenEhr::RM::DataStructures::ItemStructure include OpenEhr::RM::DataStructures::ItemStructure::Representation include OpenEhr::RM::DataTypes::Text def row(args) return args.collect do |n| Element.new(:name => DvText.new(n), :archetype_node_id => 'test') end end def cluster_builder(name,rows) return Cluster.new(:name => DvText.new(name), :archetype_node_id => 'test', :items => rows) end describe ItemTable do before(:each) do row1 = row(%w{one two three}) row2 = row(%w{four five six}) rows = [row1, row2].collect{|r| cluster_builder('cluster',r)} @item_table = ItemTable.new(:name => DvText.new('item table'), :archetype_node_id => 'test', :rows => rows) end it 'should be an instance of ItemTable' do @item_table.should be_an_instance_of ItemTable end it 'row count should be 2' do @item_table.row_count.should be_equal 2 end it 'column_count should be 3' do @item_table.column_count.should be_equal 3 end it 'row_names should be cluster cluster' do @item_table.row_names.should == %w{cluster cluster}.collect{|n| DvText.new(n)} end end