-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from theodi/info-messages-for-line-breaks
Info messages for line breaks
- Loading branch information
Showing
14 changed files
with
103 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"Foo","Bar","Baz""Biff","Baff","Boff""Qux","Teaspoon","Doge" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"Foo","Bsr","Baz" | ||
"Biff","Baff","Boff" | ||
"Qux","Teaspoon","Doge" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"Foo","Bsr","Baz""Biff","Baff","Boff" | ||
"Qux","Teaspoon","Doge" | ||
|
1 change: 1 addition & 0 deletions
1
features/fixtures/incorrect-line-endings.csv → features/fixtures/lf-line-endings.csv
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
"Foo","Bsr","Baz" | ||
"Biff","Baff","Boff" | ||
"Qux","Teaspoon","Doge" |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Given(/^I ask if there are info messages$/) do | ||
@csv_options ||= default_csv_options | ||
|
||
if @schema_json | ||
@schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", JSON.parse(@schema_json) ) | ||
end | ||
|
||
@validator = Csvlint::Validator.new( @url, @csv_options, @schema ) | ||
@info_messages = @validator.info_messages | ||
end | ||
|
||
Then(/^there should be (\d+) info messages?$/) do |num| | ||
@info_messages.count.should == num.to_i | ||
end | ||
|
||
Then(/^that message should have the type "(.*?)"$/) do |msg_type| | ||
@info_messages.first.type.should == msg_type.to_sym | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
class CustomWorld | ||
def default_csv_options | ||
return { | ||
"lineTerminator" => "\r\n" | ||
} | ||
end | ||
end | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Feature: Get validation information messages | ||
|
||
Scenario: LF line endings in file give an info message | ||
Given I have a CSV file called "lf-line-endings.csv" | ||
And it is stored at the url "http://example.com/example1.csv" | ||
And I ask if there are info messages | ||
Then there should be 1 info message | ||
And that message should have the type "nonrfc_line_breaks" | ||
|
||
Scenario: CR line endings in file give an info message | ||
Given I have a CSV file called "cr-line-endings.csv" | ||
And it is stored at the url "http://example.com/example1.csv" | ||
And I ask if there are info messages | ||
Then there should be 1 info message | ||
And that message should have the type "nonrfc_line_breaks" | ||
|
||
Scenario: CRLF line endings in file produces no info messages | ||
Given I have a CSV file called "crlf-line-endings.csv" | ||
And it is stored at the url "http://example.com/example1.csv" | ||
And I ask if there are info messages | ||
Then there should be 0 info messages |
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
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
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
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