Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-02 15:07:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-02 15:07:57 +0300
commit988b28ec1a379d38f6ac9ed04886ee564fd447fd (patch)
tree9d93267209387e62d23ea7abf81ef9c0d64f2f0b /spec/services/issues
parenta325f3a104748ecc68df7c3d793940aa709a111f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/issues')
-rw-r--r--spec/services/issues/import_csv_service_spec.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/services/issues/import_csv_service_spec.rb b/spec/services/issues/import_csv_service_spec.rb
index e7370407d4c..aa43892a36d 100644
--- a/spec/services/issues/import_csv_service_spec.rb
+++ b/spec/services/issues/import_csv_service_spec.rb
@@ -27,6 +27,29 @@ describe Issues::ImportCsvService do
end
end
+ context 'with a file generated by Gitlab CSV export' do
+ let(:file) { fixture_file_upload('spec/fixtures/csv_gitlab_export.csv') }
+
+ it 'imports the CSV without errors' do
+ expect_next_instance_of(Notify) do |instance|
+ expect(instance).to receive(:import_issues_csv_email)
+ end
+
+ expect(subject[:success]).to eq(4)
+ expect(subject[:error_lines]).to eq([])
+ expect(subject[:parse_error]).to eq(false)
+ end
+
+ it 'correctly sets the issue attributes' do
+ expect { subject }.to change { project.issues.count }.by 4
+
+ expect(project.issues.reload.last).to have_attributes(
+ title: 'Test Title',
+ description: 'Test Description'
+ )
+ end
+ end
+
context 'comma delimited file' do
let(:file) { fixture_file_upload('spec/fixtures/csv_comma.csv') }
@@ -39,6 +62,15 @@ describe Issues::ImportCsvService do
expect(subject[:error_lines]).to eq([])
expect(subject[:parse_error]).to eq(false)
end
+
+ it 'correctly sets the issue attributes' do
+ expect { subject }.to change { project.issues.count }.by 3
+
+ expect(project.issues.reload.last).to have_attributes(
+ title: 'Title with quote"',
+ description: 'Description'
+ )
+ end
end
context 'tab delimited file with error row' do
@@ -53,6 +85,15 @@ describe Issues::ImportCsvService do
expect(subject[:error_lines]).to eq([3])
expect(subject[:parse_error]).to eq(false)
end
+
+ it 'correctly sets the issue attributes' do
+ expect { subject }.to change { project.issues.count }.by 2
+
+ expect(project.issues.reload.last).to have_attributes(
+ title: 'Hello',
+ description: 'World'
+ )
+ end
end
context 'semicolon delimited file with CRLF' do
@@ -67,6 +108,15 @@ describe Issues::ImportCsvService do
expect(subject[:error_lines]).to eq([4])
expect(subject[:parse_error]).to eq(false)
end
+
+ it 'correctly sets the issue attributes' do
+ expect { subject }.to change { project.issues.count }.by 3
+
+ expect(project.issues.reload.last).to have_attributes(
+ title: 'Hello',
+ description: 'World'
+ )
+ end
end
end
end