Sha256: e0f1128915c52a6bbd52b4e7ab83642923789ae9b5bc8a8849d8ac92a1b3ec13

Contents?: true

Size: 977 Bytes

Versions: 3

Compression:

Stored size: 977 Bytes

Contents

# spec for column-plucking functions

require "spec_helper"
require "tempfile"

describe "plucker" do
  it "should pull named columns" do
    filename = File.dirname(__FILE__) + "/../data/namedcols.csv"
    tmp = Tempfile.new('plucker')
    results = Masticate.pluck(filename, :output => tmp, :fields => ['three', '5'])
    output = File.read(tmp)
    correct_output = File.read(File.dirname(__FILE__) + "/../data/namedcols.csv.output")
    tmp.unlink

    results[:input_count].should == 5
    output.should == correct_output
  end

  it "should pull numbered columns starting at 1" do
    filename = File.dirname(__FILE__) + "/../data/namedcols.csv"
    tmp = Tempfile.new('plucker')
    results = Masticate.pluck(filename, :output => tmp, :fields => [3,5])
    output = File.read(tmp)
    correct_output = File.read(File.dirname(__FILE__) + "/../data/namedcols.csv.output")
    tmp.unlink

    results[:input_count].should == 5
    output.should == correct_output
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
masticate-0.3 spec/lib/plucker_spec.rb
masticate-0.2.3 spec/lib/plucker_spec.rb
masticate-0.2.2 spec/lib/plucker_spec.rb