Sha256: 1158a2939cd9bf3619398d5395894f6bee6722362d1f7c47a3c56950581e5a4b

Contents?: true

Size: 557 Bytes

Versions: 10

Compression:

Stored size: 557 Bytes

Contents

# coding: utf-8

require 'spec_helper'

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

10 entries across 10 versions & 1 rubygems

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