Sha256: 9f4c197e9f1b3fffb6832856d76535e8cdc40cb6e7fb03c29812f9b47ba5e4a7
Contents?: true
Size: 1.35 KB
Versions: 6
Compression:
Stored size: 1.35 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 # KB Override # 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 # KB Override # 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
6 entries across 6 versions & 1 rubygems