Sha256: 2b55ce71a53ebc13cdf6f771e6a111f5647cd1d009c7d3ff8a8df3acf9cbc6da

Contents?: true

Size: 798 Bytes

Versions: 33

Compression:

Stored size: 798 Bytes

Contents

require 'spec_helper'

fixture_path = 'spec/fixtures'

# this reads a binary database dump file, which is in structure like a CSV file
# but contains control characters delimiting the rows and columns, and also 
# contains a comment section which is commented our by a leading # character

describe 'be_able_to' do
  it 'loads_binary_file_with_comments' do 
    options = {:col_sep => "\cA", :row_sep => "\cB", :comment_regexp => /^#/}
    data = SmarterCSV.process("#{fixture_path}/binary.csv", options)
    data.flatten.size.should == 8
    data.each do |item|
      # all keys should be symbols
      item.keys.each{|x| x.class.should be == Symbol}
      item[:timestamp].should == 1381388409
      item[:item_id].class.should be == Fixnum
      item[:name].size.should be > 0
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
smarter_csv-1.6.1 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.6.0 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.5.2 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.5.1 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.5.0 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.4.2 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.4.0 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.3.0 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.8 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.7 spec/smarter_csv/binary_file_spec.rb
pokedex-terminal-0.2.8 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/binary_file_spec.rb
pokedex-terminal-0.2.7 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/binary_file_spec.rb
pokedex-terminal-0.2.6 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/binary_file_spec.rb
pokedex-terminal-0.2.5 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/binary_file_spec.rb
pokedex-terminal-0.2.4 vendor/bundle/ruby/2.7.0/gems/smarter_csv-1.2.6/spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.6 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.5 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.4 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.3 spec/smarter_csv/binary_file_spec.rb
smarter_csv-1.2.0 spec/smarter_csv/binary_file_spec.rb