Add support for different column separator in csv import logic (#1096)

* add col_sep to import model

* add validation for col_sep column

* add col_sep option to csv import model

* make use of col_sep option in import model

* add column separator field to new/edit action of an import

* add col_sep parameter to create/update action

* fix spacing between fields

Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
Signed-off-by: Alexander Schrot <alexander@axs-labs.com>

---------

Signed-off-by: Alexander Schrot <alexander@axs-labs.com>
Co-authored-by: Zach Gollwitzer <zach.gollwitzer@gmail.com>
This commit is contained in:
Alexander Schrot
2024-08-16 20:00:16 +02:00
committed by GitHub
parent 707c5ca0ca
commit 4527482aa2
11 changed files with 117 additions and 19 deletions

View File

@@ -29,7 +29,7 @@ class ImportsControllerTest < ActionDispatch::IntegrationTest
test "should create import" do
assert_difference("Import.count") do
post imports_url, params: { import: { account_id: @user.family.accounts.first.id } }
post imports_url, params: { import: { account_id: @user.family.accounts.first.id, col_sep: "," } }
end
assert_redirected_to load_import_path(Import.ordered.first)
@@ -41,7 +41,7 @@ class ImportsControllerTest < ActionDispatch::IntegrationTest
end
test "should update import" do
patch import_url(@empty_import), params: { import: { account_id: @empty_import.account_id } }
patch import_url(@empty_import), params: { import: { account_id: @empty_import.account_id, col_sep: "," } }
assert_redirected_to load_import_path(@empty_import)
end