Sha256: 21db530ab0c81995d0d9e06c229bfc6c7728857e8b0171962b69c8167e24a73a

Contents?: true

Size: 825 Bytes

Versions: 10

Compression:

Stored size: 825 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.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::Table::InvalidArgument) }
  end

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

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

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

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