Created
September 11, 2015 16:45
-
-
Save quadrophobiac/93a7de937996a1e0243b to your computer and use it in GitHub Desktop.
error catching for csvlint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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