Sha256: 29a787c60e84ce80c30df230c1756df2aaba0a1b3c68381771ba44ba26bd81d0

Contents?: true

Size: 844 Bytes

Versions: 12

Compression:

Stored size: 844 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 = []
        count = IOStreams::Row::Reader.open(file_name) do |io|
          io.each { |row| rows << row }
        end
        assert_equal expected, rows
        assert_equal expected.size, count
      end

      it 'stream' do
        rows = []
        count = 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
        assert_equal expected.size, count
      end
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
iostreams-0.20.3 test/row_reader_test.rb
iostreams-0.20.2 test/row_reader_test.rb
iostreams-0.20.1 test/row_reader_test.rb
iostreams-0.20.0 test/row_reader_test.rb
iostreams-0.19.0 test/row_reader_test.rb
iostreams-0.18.0 test/row_reader_test.rb
iostreams-0.17.3 test/row_reader_test.rb
iostreams-0.17.2 test/row_reader_test.rb
iostreams-0.17.1 test/row_reader_test.rb
iostreams-0.17.0 test/row_reader_test.rb
iostreams-0.16.2 test/row_reader_test.rb
iostreams-0.16.1 test/row_reader_test.rb