Browse files

Add test for multiple colspans [suggested by flavio]

  • Loading branch information...
1 parent 5e9a7f1 commit 3b6849cd66254ffb9989688c3c0ffaa9aa055a51 @rrrene rrrene committed Oct 17, 2011
Showing with 27 additions and 0 deletions.
  1. +27 −0 spec/table_spec.rb
View
27 spec/table_spec.rb
@@ -437,5 +437,32 @@ module Terminal
+------+---+---+---+
EOF
end
+
+ it "should handle multiple colspan" do
+ @table.headings = [
+ 'name',
+ { :value => 'Values', :alignment => :right, :colspan => 2},
+ { :value => 'Other values', :alignment => :right, :colspan => 2},
+ { :value => 'Column 3', :alignment => :right, :colspan => 2}
+ ]
+
+ 3.times do |row_index|
+ row = ["row ##{row_index+1}"]
+ 6.times do |i|
+ row << row_index*6 + i
+ end
+ @table.add_row(row)
+ end
+
+ @table.render.should == <<-EOF.deindent
+ +--------+----+----+-------+-------+-----+-----+
+ | name | Values | Other values | Column 3 |
+ +--------+----+----+-------+-------+-----+-----+
+ | row #1 | 0 | 1 | 2 | 3 | 4 | 5 |
+ | row #2 | 6 | 7 | 8 | 9 | 10 | 11 |
+ | row #3 | 12 | 13 | 14 | 15 | 16 | 17 |
+ +--------+----+----+-------+-------+-----+-----+
+ EOF
+ end
end
end

0 comments on commit 3b6849c

Please sign in to comment.