Sha256: ff032380ddff01d2582b335820f1b5b2faffa265367d088f0f56726b78ab4407

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 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(TTY::InvalidArgument) }
  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.0.9 spec/tty/table/validatable/validate_options_spec.rb
tty-0.0.8 spec/tty/table/validatable/validate_options_spec.rb
tty-0.0.7 spec/tty/table/validatable/validate_options_spec.rb