Sha256: 84c90adc2046dfc668e8b263a13b40284050657d3c5cad29ccb33304e2da4025

Contents?: true

Size: 853 Bytes

Versions: 10

Compression:

Stored size: 853 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.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

10 entries across 10 versions & 1 rubygems

Version Path
tty-table-0.10.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.9.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.8.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.7.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.6.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.5.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.4.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.3.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.2.0 spec/unit/renderer/ascii/indentation_spec.rb
tty-table-0.1.0 spec/unit/renderer/ascii/indentation_spec.rb