Sha256: 035ee718c7a21fd27eba28d4c2dac510ad503bfb4fe6e540b6fd0c754910929c

Contents?: true

Size: 898 Bytes

Versions: 11

Compression:

Stored size: 898 Bytes

Contents

# spec for row exclusion

require "spec_helper"

describe "exclude" do
  it "should be able to ignore rows with blank fields" do
    filename = File.dirname(__FILE__) + "/../data/exclude_input.csv"
    tmp = Tempfile.new('exclude')
    results = Masticate.exclude(filename, :output => tmp, :field => 'ID', :value => '')
    output = File.read(tmp)
    correct_output = File.read(File.dirname(__FILE__) + "/../data/exclude_results.csv")

    output.should == correct_output
  end

  it "should be able to exclude rows by number as well as name" do
    filename = File.dirname(__FILE__) + "/../data/exclude_input.csv"
    tmp = Tempfile.new('exclude')
    results = Masticate.exclude(filename, :output => tmp, :field => 1, :value => '')
    output = File.read(tmp)
    correct_output = File.read(File.dirname(__FILE__) + "/../data/exclude_results.csv")

    output.should == correct_output
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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