spec/csv2hash/validator/collection_spec.rb in csv2hash-0.4.0 vs spec/csv2hash/validator/collection_spec.rb in csv2hash-0.5.0
- old
+ new
@@ -6,13 +6,14 @@
Csv2hash::Definition.new([ { position: 0, key: 'name' } ], Csv2hash::Definition::COLLECTION, options).tap do |definition|
definition.validate!
definition.default!
end
end
+ let(:ignore_blank_line) { false }
subject do
- Csv2hash::Main.new(definition, data_source, ignore_blank_line=false)
+ Csv2hash::Main.new(definition, data_source, ignore_blank_line: ignore_blank_line)
end
before do
allow(subject).to receive(:break_on_failure) { true }
end
@@ -28,11 +29,11 @@
end
end
context '#ignore_blank_line' do
let(:data_source) { [ [ ] ] }
- before { subject.ignore_blank_line = true }
+ let(:ignore_blank_line) { true }
it { expect { subject.validate_data! }.to_not raise_error }
context 'csv mode' do
before { subject.break_on_failure = false }
its(:errors) { should be_empty }
end
@@ -48,10 +49,10 @@
end
end
context 'wihtout exception' do
let(:data_source) { [ [ ] ]}
-
+
before do
allow(subject).to receive(:break_on_failure) { false }
end
it { expect(subject.parse.errors.to_csv).to eql ",\"undefined name on [0, 0]\"\n" }