Sha256: 5a848d18696b1aa967bd8c8c451f3d8c52c08646828947328e832cfdfb67a016
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
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 "#each" 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 "with no block returns enumerator" do rows = IOStreams::Row::Reader.file(file_name) do |io| io.each.first(100) end assert_equal expected, rows 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iostreams-1.10.1 | test/row_reader_test.rb |
iostreams-1.10.0 | test/row_reader_test.rb |