Skip to content

Commit 9433331

Browse files
committed
adding test cases
1 parent 2932041 commit 9433331

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
fixture_path = 'spec/fixtures'
4+
5+
[true, false].each do |bool|
6+
describe "loading file with empty lines with#{bool ? ' C-' : 'out '}acceleration" do
7+
let(:options) { { acceleration: bool } }
8+
9+
it 'loads the data correctly' do
10+
data = SmarterCSV.process("#{fixture_path}/empty_lines.csv", options)
11+
12+
expect(data.length).to eq 2
13+
14+
expect(data[0]).to eq({id: 1, name: 'Bob'})
15+
expect(data[1]).to eq({id: 2, name: 'Paul'})
16+
end
17+
end
18+
end

spec/fixtures/empty_lines.csv

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
id,name
2+
3+
1,Bob
4+
5+
2,Paul
6+

0 commit comments

Comments
 (0)