Sha256: c1f059ec4c852d7993ae0287f0df82feab0e38b31f663f93adf7a2e69012a214
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' require 'sepparator/spreadsheet_converter' require 'tempfile' require 'fileutils' module Sepparator describe SpreadsheetConverter do it 'remembers the column separator' do sep = 'foobar' expect(described_class.new(col_sep: sep).col_sep).to eq(sep) end context '#convert' do let(:xls_path) { Tempfile.new('convert-to-xlsx').path } let(:csv_path) { File.join(__dir__, 'example.csv')} subject { described_class.new.convert(csv_path, xls_path)} before do FileUtils.rm_f xls_path end it 'converts a CSV file' do # don't comparing xlsx files here subject expect(File.exists?(xls_path)).to be_true end it 'raises when the source file was not found' do expect{described_class.new.convert('/some/non/existing/file.csv', xls_path)}.to raise_error(ArgumentError, /file not found/) end it 'raises when the destination file already exists' do expect{described_class.new.convert('/some/non/existing/file.csv', Tempfile.new('blafoo').path)}.to raise_error(ArgumentError, /destination file exists/) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sepparator-0.0.3 | spec/sepparator/spreadsheet_converter.rb |
sepparator-0.0.2 | spec/sepparator/spreadsheet_converter.rb |
sepparator-0.0.1 | spec/sepparator/spreadsheet_converter.rb |