Sha256: 61f40c1117f6c12338a95fb4d2dca274a3e41e82498aed7583a7643f3c7fd476

Contents?: true

Size: 691 Bytes

Versions: 25

Compression:

Stored size: 691 Bytes

Contents

require 'spec_helper'

fixture_path = 'spec/fixtures'

describe 'be_able_to' do
  it 'remove_values_matching' do 
    options = {:remove_zero_values => true, :key_mapping => {:first_name => :vorname, :last_name => :nachname} }
    data = SmarterCSV.process("#{fixture_path}/basic.csv", options)
    data.size.should == 5
    # all the keys should be symbols
    data.each{|item| item.keys.each{|x| x.class.should be == Symbol}}

    data.each do |hash| 
      hash.keys.each do |key|
        [:vorname, :nachname, :dogs, :cats, :birds, :fish].should include( key )
      end
      hash.values.should_not include( 0 )
    end

    data.each do |h|
      h.size.should <= 6
    end
  end

end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
smarter_csv-1.2.8 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.2.7 spec/smarter_csv/key_mapping_spec.rb
pokedex-terminal-0.2.8 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/key_mapping_spec.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/key_mapping_spec.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/key_mapping_spec.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/key_mapping_spec.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.2.6 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.2.5 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.2.4 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.2.3 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.2.0 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.1.5 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.1.4 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.1.3 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.1.2 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.1.1 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.1.0 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.0.19 spec/smarter_csv/key_mapping_spec.rb
smarter_csv-1.0.18 spec/smarter_csv/key_mapping_spec.rb