Sha256: 27091601bcca1a52de002c91708c754fbe8d6c8a00f825f9ab0042567c672eb7
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
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 return the ImportNode as the result" do @result.should be_a(ImportNode) end it "should create as many data nodes as there are columns" do @result.children.size.should eql(3) @result.children.each {|dn| dn.should be_a(DataNode)} end it "should import the values from each column into each data node" do @result.this.values.should eql([1,4,7]) @result.and.values.should eql([2,5,8]) @result.that.values.should eql([3,6,9]) end it "should store the imported values in the knowledge base" do Fathom.knowledge_base[:this].should be_a(DataNode) Fathom.kb[:this].values.should eql([1,4,7]) end it "should import from the class level" do CSVImport.import(@opts) Fathom.knowledge_base[:this].should be_a(DataNode) Fathom.kb[:this].values.should eql([1,4,7]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fathom-0.3.0 | spec/fathom/import/csv_import_spec.rb |