spec/csv2hash/validator/collection_spec.rb in csv2hash-0.2.1 vs spec/csv2hash/validator/collection_spec.rb in csv2hash-0.3.0
- old
+ new
@@ -8,11 +8,11 @@
definition.default!
end
end
subject do
- Csv2hash.new(definition, 'file_path', true, data_source)
+ Csv2hash::Main.new(definition, data_source, exception_mode=true, ignore_blank_line=false)
end
context 'with valid data' do
let(:data_source) { [ [ 'John Doe' ] ]}
it { expect { subject.validate_data! }.to_not raise_error }
@@ -44,11 +44,11 @@
end
context 'wihtout exception' do
let(:data_source) { [ [ ] ]}
before { subject.exception_mode = false }
- it { subject.parse.errors.to_csv.should eql ",\"undefined name on [0, 0]\"\n" }
+ it { expect(subject.parse.errors.to_csv).to eql ",\"undefined name on [0, 0]\"\n" }
context 'errors should be filled' do
before { subject.parse }
its(:errors) { should eql [{x: 0, y: 0, message: 'undefined name on [0, 0]', key: 'name'}] }
end
@@ -59,10 +59,10 @@
[{ position: 0, key: 'agree', values: ['yes', 'no'] }], Csv2hash::Definition::COLLECTION).tap do |d|
d.validate!; d.default!
end
end
let(:data_source) { [ [ 'what?' ], [ 'yes' ], [ 'no' ] ] }
- it { subject.parse.errors.to_csv.should eql "what?,\"agree not supported, please use one of [\"\"yes\"\", \"\"no\"\"]\"\n" }
+ it { expect(subject.parse.errors.to_csv).to eql "what?,\"agree not supported, please use one of [\"\"yes\"\", \"\"no\"\"]\"\n" }
end
end
end