Skip to content

Business intelligence made simple

Added test for malformed CSV [skip ci]

Andrew Kane6ea1ce88c213
diff --git a/test/support/malformed.csv b/test/support/malformed.csv
new file mode 100644
index 00000000..1cc80efa
--- /dev/null
+++ b/test/support/malformed.csv
@@ -0,0 +1 @@
+"
diff --git a/test/uploads_test.rb b/test/uploads_test.rb
index 4d58d926..5c89f685 100644
--- a/test/uploads_test.rb
+++ b/test/uploads_test.rb
@@ -56,6 +56,12 @@ class UploadsTest < ActionDispatch::IntegrationTest
assert_equal ["items"], tables
end
+ def test_malformed_csv
+ post blazer.uploads_path, params: {upload: {table: "line_items", description: "Billing line items", file: fixture_file_upload("test/support/malformed.csv", "text/csv")}}
+ assert_response :unprocessable_entity
+ assert_match "Unclosed quoted field in line 1", response.body
+ end
+
def create_upload
post blazer.uploads_path, params: {upload: {table: "line_items", description: "Billing line items", file: fixture_file_upload("test/support/line_items.csv", "text/csv")}}
end