Sha256: a76d5b1997eda5ebb4016ef9a4d2172d002a9cda8376ac34be87ac92a323fec6

Contents?: true

Size: 655 Bytes

Versions: 8

Compression:

Stored size: 655 Bytes

Contents

# coding: utf-8

require 'spec_helper'

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 table }

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

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tty-table-0.9.0 spec/unit/operations/new_spec.rb
tty-table-0.8.0 spec/unit/operations/new_spec.rb
tty-table-0.7.0 spec/unit/operations/new_spec.rb
tty-table-0.6.0 spec/unit/operations/new_spec.rb
tty-table-0.5.0 spec/unit/operations/new_spec.rb
tty-table-0.4.0 spec/unit/operations/new_spec.rb
tty-table-0.3.0 spec/unit/operations/new_spec.rb
tty-table-0.2.0 spec/unit/operations/new_spec.rb