Sha256: 23f3727517a37bfc19e55dda09ca9b1b9f5394cb4473f4c7554c3e92049faff1

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

# coding: utf-8

RSpec.describe TTY::Table::Operations, '#new' do
  let(:object) { described_class }
  let(:row)    { [1,2,3] }
  let(:table)  { TTY::Table.new :rows => [row] }
  let(:callable) {
    Class.new do
      def call(val, row, col)
        val.value= val.value + 1
      end
    end
  }
  let(:instance) { callable.new }

  subject { object.new }

  before { subject.add(:alignment, instance) }

  it 'stores away operations' do
    expect(subject[:alignment]).to include(instance)
  end

  it 'applies selected operations' do
    subject.apply_to(table, :alignment)
    expect(table.data[0]).to eql([2,3,4])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-table-0.10.0 spec/unit/operations/new_spec.rb