Sha256: 30733bffbabea168e37efa3b33be94e8b6400e87315076717d3a4163b24aeeb6
Contents?: true
Size: 1011 Bytes
Versions: 4
Compression:
Stored size: 1011 Bytes
Contents
require 'spec_helper' module Csv2hash describe Parser do let(:definition) do Main.generate_definition :foo do set_type { Definition::COLLECTION } mapping { cell position: 0, key: 'name' } end end let(:john) { ' John Doe ' } let(:jane) { ' Jane Doe ' } let(:data_source) { [ [ john ], [ jane ] ] } let(:ignore_blank_line) { false } subject do Main.new(definition, data_source, ignore_blank_line: ignore_blank_line, sanitizer: sanitizer) end context 'regular way' do let(:sanitizer) { false } it { expect(subject.tap do |parser| parser.parse! end.data).to eql({ data: [ { 'name' => john }, { 'name' => jane } ] }) } end context 'sanitizer way' do let(:sanitizer) { true } it { expect(subject.tap do |parser| parser.parse! end.data).to eql({ data: [ { 'name' => 'John Doe' }, { 'name' => 'Jane Doe' } ] }) } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
csv2hash-0.7.7 | spec/csv2hash/parser_spec.rb |
csv2hash-0.7.6 | spec/csv2hash/parser_spec.rb |
csv2hash-0.7.5 | spec/csv2hash/parser_spec.rb |
csv2hash-0.7.3 | spec/csv2hash/parser_spec.rb |