-
Notifications
You must be signed in to change notification settings - Fork 83
Add possibility to configure pretty json in .babelish #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
fb0c4a3
5ae5c05
ffb7b19
e58e599
b8eef7e
aa36473
d7f7ca9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,4 +24,40 @@ def test_converting_csv_to_dotstrings_one_output_option | |
| # clean up | ||
| system("rm -rf ./" + single_file) | ||
| end | ||
|
|
||
| def test_converting_csv_to_json_with_unpretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = "test_unpretty_json.json" | ||
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/TrailingWhitespace: Trailing whitespace detected. |
||
| { "English" => "en" }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/AlignParameters: Align the parameters of a method call if they span more than one line. |
||
| output_basename: "output", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/AlignParameters: Align the parameters of a method call if they span more than one line. |
||
| pretty_json: false) | ||
| converter.convert | ||
| given_json = File.read(given_json_filename) | ||
| assert_equal(expected_json, given_json, "JSON file has incorrect format") | ||
|
|
||
| # clean up | ||
| system("rm -rf ./" + given_json_filename) | ||
| end | ||
|
|
||
| def test_converting_csv_to_json_with_pretty_json | ||
| csv_file = "test/data/test_data.csv" | ||
| expected_json_filename = "test_pretty_json.json" | ||
| given_json_filename = "output.json" | ||
|
|
||
| expected_json = File.read("test/data/" + expected_json_filename) | ||
| converter = Babelish::CSV2JSON.new(csv_file, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/TrailingWhitespace: Trailing whitespace detected. |
||
| { "English" => "en" }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/AlignParameters: Align the parameters of a method call if they span more than one line. |
||
| output_basename: "output", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/AlignParameters: Align the parameters of a method call if they span more than one line. |
||
| pretty_json: true) | ||
| converter.convert | ||
| given_json = File.read(given_json_filename) | ||
| assert_equal(expected_json, given_json, "JSON file has incorrect format") | ||
|
|
||
| # clean up | ||
| system("rm -rf ./" + given_json_filename) | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "ERROR_HANDLER_WARNING_DISMISS": "OK", | ||
| "ANOTHER_STRING": "hello" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"ERROR_HANDLER_WARNING_DISMISS":"OK","ANOTHER_STRING":"hello"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Metrics/LineLength: Line is too long. [105/80]