Sha256: 388aab70ef58c1301167db6ead6cea964a345fa71552d441970ceae16da72893

Contents?: true

Size: 1013 Bytes

Versions: 9

Compression:

Stored size: 1013 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe TTY::Table::Renderer::Basic, 'with separator' do
  let(:header) { ['h1', 'h2', 'h3'] }
  let(:rows)   { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
  let(:table)  { TTY::Table.new(header, rows) }

  let(:object) { described_class.new table }

  subject(:renderer) { object }

  context 'when default' do
    it "sets through hash" do
      renderer.border :separator => :each_row
      expect(renderer.border.separator).to eql(:each_row)
    end

    it "sets through attribute" do
      renderer.border.separator= :each_row
      expect(renderer.border.separator).to eql(:each_row)
    end

    it "sets through block" do
      renderer.border do
        separator :each_row
      end
      expect(renderer.border.separator).to eql(:each_row)
    end

    it "renders each row" do
      renderer.border.separator= :each_row
      expect(renderer.render).to eq unindent(<<-EOS)
        h1 h2 h3

        a1 a2 a3

        b1 b2 b3
      EOS
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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