spec/unit/renderer/ascii/resizing_spec.rb in tty-table-0.1.0 vs spec/unit/renderer/ascii/resizing_spec.rb in tty-table-0.2.0

- old
+ new

@@ -12,11 +12,11 @@ context 'when expanding' do context 'even columns' do let(:options) { {width: 16, resize: true} } it 'resizes each column' do - expect(renderer.render).to eql <<-EOS.normalize + expect(renderer.render).to eql unindent(<<-EOS) +----+----+----+ |h1 |h2 |h3 | +----+----+----+ |a1 |a2 |a3 | |b1 |b2 |b3 | @@ -29,11 +29,11 @@ let(:header) { ['h1', 'h2', 'h3', 'h4'] } let(:rows) { [['a1','a2','a3','a4'], ['b1','b2','b3','b4']] } let(:options) { {width: 21, resize: true} } it 'resizes each column' do - expect(renderer.render).to eql <<-EOS.normalize + expect(renderer.render).to eql unindent(<<-EOS) +----+----+----+----+ |h1 |h2 |h3 |h4 | +----+----+----+----+ |a1 |a2 |a3 |a4 | |b1 |b2 |b3 |b4 | @@ -46,11 +46,11 @@ let(:header) { ['h1', 'h2', 'h3'] } let(:rows) { [['aaa1', 'aa2', 'aaaaaaa3'], ['b1', 'b2', 'b3']] } let(:options) { {width: 32, resize: true} } it 'resizes each column' do - expect(renderer.render).to eql <<-EOS.normalize + expect(renderer.render).to eql unindent(<<-EOS) +---------+-------+------------+ |h1 |h2 |h3 | +---------+-------+------------+ |aaa1 |aa2 |aaaaaaa3 | |b1 |b2 |b3 | @@ -63,49 +63,49 @@ context 'when shrinking' do let(:header) { ['head1', 'head2'] } let(:rows) { [['aaaa1','aaaa2',], ['bbbb1','bbbb2']] } context 'even columns' do - let(:options) { {width: 7, resize: true} } + let(:options) { {width: 9, resize: true} } it 'resizes each column' do - expect(renderer.render).to eql <<-EOS.normalize - +--+--+ - |h…|h…| - +--+--+ - |a…|a…| - |b…|b…| - +--+--+ + expect(renderer.render).to eql unindent(<<-EOS) + +---+---+ + |h… |h… | + +---+---+ + |a… |a… | + |b… |b… | + +---+---+ EOS end end context 'even columns with extra width' do - let(:options) { {width: 8, resize: true} } + let(:options) { {width: 10, resize: true} } it 'resizes each column' do - expect(renderer.render).to eql <<-EOS.normalize - +---+--+ - |he…|h…| - +---+--+ - |aa…|a…| - |bb…|b…| - +---+--+ + expect(renderer.render).to eql unindent(<<-EOS) + +----+---+ + |he… |h… | + +----+---+ + |aa… |a… | + |bb… |b… | + +----+---+ EOS end end context 'uneven columns' do let(:header) { ['head1', 'head2', 'head3'] } let(:rows) { [['aaa1', 'aa2', 'aaaaaaa3'], ['b1', 'b2', 'b3']] } let(:options) { {width: 15, resize: true} } it 'resizes each column' do - expect(renderer.render).to eql <<-EOS.normalize + expect(renderer.render).to eql unindent(<<-EOS) +---+---+-----+ - |he…|he…|head3| + |h… |h… |head3| +---+---+-----+ - |aa…|aa2|aaaa…| + |a… |aa2|aaa… | |b1 |b2 |b3 | +---+---+-----+ EOS end end