Sha256: 5abaae45ac546ba0131dfed345eebf40f35008e21195b91d0229acb7a943b6b6

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 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

3 entries across 3 versions & 1 rubygems

Version Path
tty-0.1.2 spec/tty/table/border/options/from_spec.rb
tty-0.1.1 spec/tty/table/border/options/from_spec.rb
tty-0.1.0 spec/tty/table/border/options/from_spec.rb