Sha256: 0eb7949a3ece8b871005588747f16ba633de8ff3fc65f785506a7ac0dfc75f68

Contents?: true

Size: 859 Bytes

Versions: 4

Compression:

Stored size: 859 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

describe TTY::Table::BorderOptions, '#from' do

  subject(:options) { described_class.from object }

  context 'when empty hash' do
    let(:object) { {} }

    it { expect(options.style).to be_nil }

    it { expect(options.separator).to be_nil }
  end

  context 'when hash' do
    let(:object) { { :style => :red, :separator => :none } }

    it { expect(options).to be_kind_of(described_class) }

    it { expect(options.style).to eql :red }

    it { expect(options.separator).to eql :none }

    it { expect(options.characters).to eql({}) }
  end

  context 'when other BorderOptions' do
    let(:object) { described_class.new(nil, nil, :blue) }

    it { expect(options).to eql object }

    it { expect(options.characters).to eql({}) }

    it { expect(options.style).to eql :blue }
  end

end # from

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/table/border/options/from_spec.rb
tty-0.0.10 spec/tty/table/border/options/from_spec.rb
tty-0.0.9 spec/tty/table/border/options/from_spec.rb
tty-0.0.8 spec/tty/table/border/options/from_spec.rb