Sha256: a184b367ad44530d9f9ab16de6c196a640dba28c94b1ee2660a680bbf2eba887

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

require 'spec_helper'

describe Itiel::Extract::CSVFile do
  before :each do
    @step = Itiel::Extract::CSVFile.new 'FILENAME'
  end

  describe "#extract" do
    it "reads a csv file and returns it as a hash to the stream" do
      row = double
      allow(row).to receive(:to_hash).and_return({data: true})

      @stream = [ row ]
      allow(CSV).to receive(:read).
          with('FILENAME', headers: true).
          and_return(@stream)

      expect(@step.extract).to eq [{ data: true }]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itiel-0.1.2 spec/extract/csv_file_spec.rb
itiel-0.1.1 spec/extract/csv_file_spec.rb
itiel-0.1.0 spec/extract/csv_file_spec.rb