Sha256: 46d6fae30744d2506601a6d8bd58ddda665468ce1968f90845ccf4900d348d32

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Terminal::Table do
  Row = Terminal::Table::Row
  
  it "should default alignment to the left" do
    row = Row.new Terminal::Table.new, ["a", "b", "c"]
    cell = row.cells.first
    cell.value.should == 'a'
    cell.alignment.should == :left
  end

  it "should allow overriding of alignment" do
    row = Row.new Terminal::Table.new, [{:value => 'a', :alignment => :center}, "b", "c"]
    cell = row.cells.first
    cell.value.should == 'a'
    cell.alignment.should == :center
  end

  it "should calculate height for multiline cells" do
    row = Row.new Terminal::Table.new, [{:value => 'a', :alignment => :center}, "b", "c\nb"]
    row.height.should == 2
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
galileo-0.2.1 lib/terminal-table/spec/row_spec.rb
galileo-0.2.0 lib/terminal-table/spec/row_spec.rb
galileo-0.1.1 lib/terminal-table/spec/row_spec.rb
galileo-0.1.0 lib/terminal-table/spec/row_spec.rb