Skip to content

Instantly share code, notes, and snippets.

@quadrophobiac
Created September 11, 2015 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quadrophobiac/93a7de937996a1e0243b to your computer and use it in GitHub Desktop.
Save quadrophobiac/93a7de937996a1e0243b to your computer and use it in GitHub Desktop.
error catching for csvlint
context "error matching tests" do
it "checks for blank rows" do
# stream = StringIO.new('"","",') # this returns blank_rows
# stream = StringIO.new('"","",\r\n"","",\r\n') # this returns :whitespace
# stream = StringIO.new('"a",“b“,"c"""') # should return stray quotes but doesn't - there isn't a stray quote test in current code base
# stream = StringIO.new("\"a,\"b\",\"c\"\n") # returns unclosed quotes
validator = Csvlint::Validator.new(stream,"header" => false) # dialect options to avoid one liners being read as header
expect(validator.valid?).to eql(false)
expect(validator.errors.count).to eq(1)
expect(validator.errors.first.type).to eql(:blank_rows)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment