Sha256: bb5bd684ed4079edbd2613ab0ed8a124b6dfea999dca3348647ea8d1b057271b

Contents?: true

Size: 564 Bytes

Versions: 4

Compression:

Stored size: 564 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

describe TTY::Table, '#<<' do
  let(:rows) { ['a', 'b', 'c'] }
  let(:object) { described_class }

  subject(:table) { object[rows] }

  context 'with primitive values' do
    let(:row) { [1, 2, 3] }

    it 'extracts values correctly' do
      table << row
      expect(table.to_a.last).to eql(row)
    end
  end

  context 'with complex values' do
    let(:row) { [1, { :value => 2 }, 3] }

    it 'extracts values correctly' do
      table << row
      expect(table.to_a.last).to eql([1,2,3])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/table/add_row_spec.rb
tty-0.0.10 spec/tty/table/add_row_spec.rb
tty-0.0.9 spec/tty/table/add_row_spec.rb
tty-0.0.8 spec/tty/table/add_row_spec.rb