Sha256: d4d8f8d75b2fd8d4a1155149a77f34e13f1d79b0cff64bc136fb1efbd7f3fc15

Contents?: true

Size: 800 Bytes

Versions: 3

Compression:

Stored size: 800 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Table::Validatable, '#validate_options!' do
  let(:described_class) { Class.new { include TTY::Table::Validatable } }

  subject { described_class.new.validate_options! options }

  context 'with empty rows' do
    let(:options) { {rows: []} }

    it { expect { subject }.not_to raise_error() }
  end

  context 'with invalid rows type' do
    let(:options) { {rows: 1 } }

    it { expect { subject }.to raise_error(TTY::InvalidArgument) }
  end

  context 'with empty header' do
    let(:options) { {header: []} }

    it { expect { subject }.to raise_error(TTY::InvalidArgument) }
  end

  context 'with invalid header type' do
    let(:options) { {header: 1} }

    it { expect { subject }.to raise_error(TTY::InvalidArgument) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tty-0.1.2 spec/tty/table/validatable/validate_options_spec.rb
tty-0.1.1 spec/tty/table/validatable/validate_options_spec.rb
tty-0.1.0 spec/tty/table/validatable/validate_options_spec.rb