Sha256: b21dc4cc12672a36aab04c527ab24217c86f36147a229f8f2928d3bd440ef9a3

Contents?: true

Size: 820 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/table/validatable/validate_options_spec.rb
tty-0.0.10 spec/tty/table/validatable/validate_options_spec.rb