Sha256: 9648d2ccf6f4faa207d61c75720be16949670620856a60f66b5a9e7a337842f7

Contents?: true

Size: 849 Bytes

Versions: 3

Compression:

Stored size: 849 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Table::Renderer::ASCII, 'indentation' do
  let(:header)  { ['h1', 'h2', 'h3'] }
  let(:rows)    { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
  let(:table)   { TTY::Table.new(header, rows) }
  let(:indent)  { 2 }
  let(:options) { {indent: indent } }

  subject(:renderer) { described_class.new(table, options)}

  context 'when default' do
    it 'indents by value' do
      expect(renderer.render).to eql <<-EOS.chomp
  +--+--+--+
  |h1|h2|h3|
  +--+--+--+
  |a1|a2|a3|
  |b1|b2|b3|
  +--+--+--+
      EOS
    end
  end

  context 'when each row' do
    it 'indents by value' do
      renderer.border.separator = :each_row
      expect(renderer.render).to eql <<-EOS.chomp
  +--+--+--+
  |h1|h2|h3|
  +--+--+--+
  |a1|a2|a3|
  +--+--+--+
  |b1|b2|b3|
  +--+--+--+
      EOS
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tty-0.1.2 spec/tty/table/renderer/ascii/indentation_spec.rb
tty-0.1.1 spec/tty/table/renderer/ascii/indentation_spec.rb
tty-0.1.0 spec/tty/table/renderer/ascii/indentation_spec.rb