Sha256: b7ab68e7adcc7960828884b757bf9f1e09c53c9dcf7e7dcc9b9de86df6074292

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# Copyright:: (c) Autotelik Media Ltd 2011
# Author ::   Tom Statter
# Date ::     Aug 2011
# License::   MIT
#
# Details::   Specs for base class Loader
#
require File.dirname(__FILE__) + '/../spec_helper'

describe 'Headers' do
  before(:each) do
  end

  context 'No Initial Headers' do
    it 'should be able to populate empty' do
      expect(DataShift::Headers.new( :csv, 0 )).to be
    end

    it 'should be able to identify the source and index' do
      h = DataShift::Headers.new( :csv, 2 )
      expect(h.source).to eq :csv
      expect(h.idx).to eq 2
    end

    it 'should act like an Array' do
      h = DataShift::Headers.new( :csv, 0 )

      expect(h.respond_to?(:each)).to eq true
    end

    it 'should be able to add headers as if using an Array' do
      h = DataShift::Headers.new( :csv, 0 )

      expect(h.size).to eq 0
      expect(h.empty?).to eq true

      h << 'sku'

      expect(h.size).to eq 1
      expect(h.empty?).to eq false
    end

    it 'should be able to read headers as if using an Array' do
      h = DataShift::Headers.new( :csv, 0 )

      expect(h.size).to eq 0
      expect(h.empty?).to eq true

      h << 'sku'

      expect(h.size).to eq 1
      expect(h.empty?).to eq false
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datashift-0.40.1 spec/datashift/headers_spec.rb
datashift-0.40.0 spec/datashift/headers_spec.rb