spec/csv2hash/validator/mapping_spec.rb in csv2hash-0.6.4 vs spec/csv2hash/validator/mapping_spec.rb in csv2hash-0.6.5

- old
+ new

@@ -23,25 +23,25 @@ it { expect { subject.validate_data! }.to_not raise_error } end context 'with invalid data' do let(:data_source) { [ [ ] ]} - it { expect { subject.validate_data! }.to raise_error('undefined name on [0, 0]') } + it { expect { subject.validate_data! }.to raise_error('undefined :name on [0, 0]') } 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" } + 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'}] } + its(:errors) { should eql [{x: 0, y: 0, message: 'undefined :name on [0, 0]', key: 'name'}] } end context 'original csv + errors should be returned' do let(:definition) do Main.generate_definition :foo do @@ -54,11 +54,11 @@ end.tap { |d| d.validate! ; d.default! } end context 'string values' do let(:data_source) { [ [ 'what?' ], [ 'yes', 'what?' ], [ 'yes', 'what?', 'no' ] ] } it { expect(subject.parse.errors.to_csv).to eql( - "what?,\"agree not supported, please use one of [\"\"yes\"\", \"\"no\"\"]\"\n") } + "what?,\"value <what?> not supported for :agree, please use one of <[\"\"yes\"\", \"\"no\"\"]>\"\n") } end context 'range values' do let(:definition) do Main.generate_definition :foo do set_type { Definition::MAPPING } @@ -68,10 +68,11 @@ cell position: [2,0], key: 'score', values: 1..10 end end.tap { |d| d.validate! ; d.default! } end let(:data_source) { [ [ 12 ], [ 2, 12 ], [ 3, 12, 1 ] ] } - it { expect(subject.parse.errors.to_csv).to eql("12,\"score not supported, please use one of 1..10\"\n") } + it { expect(subject.parse.errors.to_csv).to eql( + "12,\"value <12> not supported for :score, please use one of <1..10>\"\n") } end end context 'with extra_validator' do let(:definition) do