Sha256: cf9f0db1fd46fc96406192753f7f0942bfff35f0114e82eed3440ae38b36ea30

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Table::Operation::Alignment, '#new' do
  let(:object) { described_class }

  subject { object.new(type) }

  context 'with no type' do
    let(:type) { nil }

    it { is_expected.to be_instance_of(object) }

    it { expect(subject.type).to eql(:left) }
  end

  context 'with unrecognized type' do
    let(:type) { :unknown }

    it 'raises exception' do
      expect { subject }.to raise_error(TTY::TypeError)
    end
  end

  context 'with coerced type' do
    let(:type) { 'center' }

    it { expect(subject.type).to eql(:center) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tty-0.1.2 spec/tty/table/operation/alignment/new_spec.rb
tty-0.1.1 spec/tty/table/operation/alignment/new_spec.rb
tty-0.1.0 spec/tty/table/operation/alignment/new_spec.rb