Sha256: 1f9f3839aed6a9ec99b27b96bd372a8d9cb7bc24d5c4b3c68bafc0ea9d2c639b

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

include Fathom

describe CSVImport do
  
  before do
    @content =<<-END
      this,and,that
      1,2,3
      4,5,6
      7,8,9
    END
    
    @opts = {:content => @content}
    @ci = CSVImport.new(@opts)
    @result = @ci.import
  end
  
  it "should not work unless content is set" do
    lambda{CSVImport.new.import}.should raise_error(NoMethodError)
    lambda{CSVImport.new(@opts)}.should_not raise_error
  end
  
  it "should create as many data nodes as there are columns" do
    @result.size.should eql(3)
    @result.each {|dn| dn.should be_a(DataNode)}
  end
  
  it "should import the values from each column into each data node" do
    @result[0].values.should eql([1,4,7])
    @result[1].values.should eql([2,5,8])
    @result[2].values.should eql([3,6,9])
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fathom-0.1.0 spec/fathom/import/csv_import_spec.rb