Sha256: 3b003a54512c8e5f441a94814e1bbbd85c5278689ed57d9607ddc717a5c123b0

Contents?: true

Size: 820 Bytes

Versions: 9

Compression:

Stored size: 820 Bytes

Contents

require_relative 'test_helper'

# Unit Test for IOStreams::File
module Streams
  class CSVReaderTest < Minitest::Test
    describe IOStreams::CSV::Reader do
      before do
        @file_name = File.join(File.dirname(__FILE__), 'files', 'test.csv')
        @data      = CSV.read(@file_name)
      end

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

        it 'stream' do
          rows = []
          File.open(@file_name) do |file|
            IOStreams::CSV::Reader.open(file) do |io|
              io.each { |row| rows << row }
            end
          end
          assert_equal @data, rows
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iostreams-0.14.0 test/csv_reader_test.rb
iostreams-0.13.0 test/csv_reader_test.rb
iostreams-0.12.1 test/csv_reader_test.rb
iostreams-0.12.0 test/csv_reader_test.rb
iostreams-0.11.0 test/csv_reader_test.rb
iostreams-0.10.1 test/csv_reader_test.rb
iostreams-0.10.0 test/csv_reader_test.rb
iostreams-0.9.1 test/csv_reader_test.rb
iostreams-0.9.0 test/csv_reader_test.rb