Sha256: c6810105754c60194ba4167010c7b63febf49686e2b8c3fc6548949a54ee103b

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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 <<-EOS.normalize
        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/basic/separator_spec.rb
tty-0.1.1 spec/tty/table/renderer/basic/separator_spec.rb
tty-0.1.0 spec/tty/table/renderer/basic/separator_spec.rb