Sha256: 2289a83f4f29281f05d0a5ca49c8c283a4a1cd16f8011c55081739f6abbc7132

Contents?: true

Size: 854 Bytes

Versions: 16

Compression:

Stored size: 854 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.file(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(file_name) do |file|
          IOStreams::Row::Reader.stream(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

16 entries across 16 versions & 1 rubygems

Version Path
iostreams-1.9.0 test/row_reader_test.rb
iostreams-1.8.0 test/row_reader_test.rb
iostreams-1.7.0 test/row_reader_test.rb
iostreams-1.6.2 test/row_reader_test.rb
iostreams-1.6.1 test/row_reader_test.rb
iostreams-1.6.0 test/row_reader_test.rb
iostreams-1.5.1 test/row_reader_test.rb
iostreams-1.5.0 test/row_reader_test.rb
iostreams-1.4.0 test/row_reader_test.rb
iostreams-1.3.3 test/row_reader_test.rb
iostreams-1.3.2 test/row_reader_test.rb
iostreams-1.3.1 test/row_reader_test.rb
iostreams-1.3.0 test/row_reader_test.rb
iostreams-1.2.1 test/row_reader_test.rb
iostreams-1.2.0 test/row_reader_test.rb
iostreams-1.1.1 test/row_reader_test.rb