Sha256: 8d5aca649b42a857e511c1c5a7d9c92f2263d3a4f8aa3780e8cd180577e77a2c

Contents?: true

Size: 886 Bytes

Versions: 3

Compression:

Stored size: 886 Bytes

Contents

# require 'spec_helper'

require 'pry'
describe CsvImportAnalyzer::CsvSanitizer do
  let (:csv_sanitizer) { CsvImportAnalyzer::CsvSanitizer.new }
  it 'should handle file not found issue' do
    expect(csv_sanitizer.process("sample.csv", options = {})).to be_instance_of(FileNotFound)
  end
  #Testing private methods - Although one should really have to test private methods, it's 
  context 'testing private methods' do
    let (:test) {"\"t1\", 't2', \"t3\""}
    let (:res) {"\"t1\", \"t2\", \"t3\""}
    xit 'should replace single quotes to double' do
      binding.pry
      expect(csv_sanitizer.send(:replace_line_single_quotes, test, ",")).to eq(res)
    end
    let (:test) {["t1","t2","",nil,"t3"]}
    let (:res) {["t1","t2","NULL","NULL","t3"]}
    it 'should replace null values' do
      expect(csv_sanitizer.send(:replace_null_values, test)).to eq(res)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csv-import-analyzer-0.0.3 spec/csv-import-analyzer/csv_sanitizer_spec.rb
csv-import-analyzer-0.0.2 spec/csv-import-analyzer/csv_sanitizer_spec.rb
csv-import-analyzer-0.0.1 spec/csv-import-analyzer/csv_sanitizer_spec.rb