Sha256: aec0b5ad8b35b4a600b796a47b865a14ff7354a6e1141d7cf41a81347411d1d0

Contents?: true

Size: 1013 Bytes

Versions: 2

Compression:

Stored size: 1013 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
      renderer.render.should == <<-EOS.normalize
        h1 h2 h3

        a1 a2 a3

        b1 b2 b3
      EOS
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/table/renderer/basic/separator_spec.rb
tty-0.0.10 spec/tty/table/renderer/basic/separator_spec.rb