spec/csv2hash/structure_validator_spec.rb in csv2hash-0.6.0 vs spec/csv2hash/structure_validator_spec.rb in csv2hash-0.6.1
- old
+ new
@@ -16,11 +16,11 @@
Main.new(definition, data_source, ignore_blank_line: false)
end
context 'the csv with errors' do
before do
- allow(definition).to receive(:structure_rules) {{ 'MaxColumns' => 2 }}
+ allow(definition).to receive(:structure_rules) {{ max_columns: 2 }}
subject.parse
end
let(:data_source) do
[
[ 'John', 'Doe' ],
@@ -28,17 +28,18 @@
]
end
its(:csv_with_errors) { should be_kind_of CsvArray }
it "adds structure error in first cell" do
+
expect(subject.csv_with_errors.first[:message]).to eq 'Too many columns (max. 2) on line 1'
end
end
context '#MaxColumns' do
before do
- allow(definition).to receive(:structure_rules) {{ 'MaxColumns' => 2 }}
+ allow(definition).to receive(:structure_rules) {{ max_columns: 2 }}
allow(subject).to receive(:break_on_failure) { true }
end
context 'valid data' do
let(:data_source) do
@@ -60,10 +61,10 @@
end
end
context '#MinColumns' do
before do
- allow(definition).to receive(:structure_rules) {{ 'MinColumns' => 2 }}
+ allow(definition).to receive(:structure_rules) {{ min_columns: 2 }}
allow(subject).to receive(:break_on_failure) { true }
end
context 'valid data' do
let(:data_source) do