Sha256: 753d0cb053eec7cd9b4e668a33737057d9ed624b68b94b14d69a90f9eb9f6758

Contents?: true

Size: 977 Bytes

Versions: 10

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 == 4
    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 == 4
    output.should == correct_output
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
masticate-0.6.2 spec/lib/plucker_spec.rb
masticate-0.6.1 spec/lib/plucker_spec.rb
masticate-0.6.0 spec/lib/plucker_spec.rb
masticate-0.5.1 spec/lib/plucker_spec.rb
masticate-0.5.0 spec/lib/plucker_spec.rb
masticate-0.4.2 spec/lib/plucker_spec.rb
masticate-0.4.1 spec/lib/plucker_spec.rb
masticate-0.4.0 spec/lib/plucker_spec.rb
masticate-0.3.2 spec/lib/plucker_spec.rb
masticate-0.3.1 spec/lib/plucker_spec.rb