Sha256: 7689cf9d2b65be7034d45826063bb8760f8b097321ed948f5e63363c563c1333

Contents?: true

Size: 756 Bytes

Versions: 4

Compression:

Stored size: 756 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'spec_helper'

describe TTY::Table::Row, '#new' do
  let(:object) { described_class }

  subject { object.new data }

  context 'with no arguments' do
    let(:data) { [] }

    it { should be_instance_of(object) }

    it { should be_empty }

    its(:attributes) { should == [] }

    its(:data) { should == { }}
  end

  context 'with Array argument' do
    let(:data) { ['a'] }

    it { should be_instance_of(object) }

    its(:attributes) { should == [0] }

    its(:to_hash) { should == {0 => "a"} }
  end

  context 'with Hash argument' do
    let(:data) { {:id => 'a'} }

    it { should be_instance_of(object) }

    its(:attributes) { should == [:id] }

    its(:to_hash) { should == {:id => 'a'} }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tty-0.0.11 spec/tty/table/row/new_spec.rb
tty-0.0.10 spec/tty/table/row/new_spec.rb
tty-0.0.9 spec/tty/table/row/new_spec.rb
tty-0.0.8 spec/tty/table/row/new_spec.rb