Sha256: 0772f4ad19c9079bb5f6c9df923d9991778fb887ddaf4f0c34ec6ebd6d37ab11
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
# -*- encoding: utf-8 -*- require 'spec_helper' describe TTY::Table::Renderer::Unicode, '#render' do let(:header) { ['h1', 'h2', 'h3'] } let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] } let(:table) { TTY::Table.new header, rows } subject { described_class.new(table) } context 'with rows only' do let(:table) { TTY::Table.new rows } it 'display table rows' do subject.render.should == <<-EOS.normalize ┌──┬──┬──┐ │a1│a2│a3│ │b1│b2│b3│ └──┴──┴──┘ EOS end end context 'with header' do it 'displays table with header' do subject.render.should == <<-EOS.normalize ┌──┬──┬──┐ │h1│h2│h3│ ├──┼──┼──┤ │a1│a2│a3│ │b1│b2│b3│ └──┴──┴──┘ EOS end end context 'with short header' do let(:header) { ['h1', 'h2'] } let(:rows) { [['aaa1', 'a2'], ['b1', 'bb1']] } it 'displays table according to widths' do subject.render.should == <<-EOS.normalize ┌────┬───┐ │h1 │h2 │ ├────┼───┤ │aaa1│a2 │ │b1 │bb1│ └────┴───┘ EOS end end context 'with long header' do let(:header) { ['header1', 'header2', 'header3'] } it 'header greater than row sizes' do subject.render.to_s.should == <<-EOS.normalize ┌───────┬───────┬───────┐ │header1│header2│header3│ ├───────┼───────┼───────┤ │a1 │a2 │a3 │ │b1 │b2 │b3 │ └───────┴───────┴───────┘ EOS end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tty-0.0.11 | spec/tty/table/renderer/unicode/render_spec.rb |
tty-0.0.10 | spec/tty/table/renderer/unicode/render_spec.rb |