Sha256: a177de09d8e0ce7d85b9112919ca024b93c9571e023480b10fc995d3e20ad324

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

require_relative 'test_helper'

class RowReaderTest < Minitest::Test
  describe IOStreams::Row::Reader do
    let :file_name do
      File.join(File.dirname(__FILE__), 'files', 'test.csv')
    end

    let :expected do
      CSV.read(file_name)
    end

    describe '.open' do
      it 'file' do
        rows = []
        IOStreams::Row::Reader.open(file_name) do |io|
          io.each { |row| rows << row }
        end
        assert_equal expected, rows
      end

      it 'stream' do
        rows = []
        IOStreams.line_reader(file_name) do |file|
          IOStreams::Row::Reader.open(file) do |io|
            io.each { |row| rows << row }
          end
        end
        assert_equal expected, rows
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iostreams-0.16.0 test/row_reader_test.rb
iostreams-0.15.0 test/row_reader_test.rb