Sha256: b379f62afbd21ad5816632712d69ac97c4b78851f97ffe841feeb03aa929bcf7

Contents?: true

Size: 715 Bytes

Versions: 10

Compression:

Stored size: 715 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe TTY::Table::Row, '#new' do
  let(:yields) { [] }
  let(:value)  { 'a1' }
  let(:header) { ['Header1']}
  let(:row)    { [ value ] }
  let(:object) { described_class.new row, header }

  context 'with block' do
    subject { object.each { |field| yields << field } }

    it 'yields only fields' do
      subject
      yields.each { |field| expect(field).to be_instance_of(value.class) }
    end

    it 'yields rows with expected attributes' do
      subject
      yields.each { |field| expect(field).to eql(value) }
    end

    it 'yields each row' do
      expect { subject }.to change { yields }.
        from( [] ).
        to( yields )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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