Sha256: 354a5333f9492a0cb5e75ef2bd95792b0abe5a3d4f17798dc0219685b5c15e62

Contents?: true

Size: 848 Bytes

Versions: 10

Compression:

Stored size: 848 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.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

10 entries across 10 versions & 1 rubygems

Version Path
tty-table-0.10.0 spec/unit/border/options/from_spec.rb
tty-table-0.9.0 spec/unit/border/options/from_spec.rb
tty-table-0.8.0 spec/unit/border/options/from_spec.rb
tty-table-0.7.0 spec/unit/border/options/from_spec.rb
tty-table-0.6.0 spec/unit/border/options/from_spec.rb
tty-table-0.5.0 spec/unit/border/options/from_spec.rb
tty-table-0.4.0 spec/unit/border/options/from_spec.rb
tty-table-0.3.0 spec/unit/border/options/from_spec.rb
tty-table-0.2.0 spec/unit/border/options/from_spec.rb
tty-table-0.1.0 spec/unit/border/options/from_spec.rb