Sha256: ccab2030d22519677557741f8522ff04a3c15a97115eff08e9af20136600f797
Contents?: true
Size: 775 Bytes
Versions: 20
Compression:
Stored size: 775 Bytes
Contents
# frozen_string_literal: true require 'rails_helper' describe 'importing a csv batch', :clean do subject(:importer) { Zizia::Importer.new(parser: parser) } let(:parser) { Zizia::CsvParser.new(file: file) } let(:file) { File.open('spec/fixtures/example.csv') } it 'creates a record for each CSV line' do expect { importer.import }.to change { Work.count }.to 3 end describe 'validation' do context 'with invalid CSV' do let(:file) { File.open('spec/fixtures/bad_example.csv') } it 'outputs invalid file notice to Rails.logger' do expect(Rails.logger).to receive(:error).with("[zizia] CSV::MalformedCSVError: Illegal quoting in line 2. (Zizia::CsvFormatValidator)") parser.validate end end end end
Version data entries
20 entries across 20 versions & 1 rubygems