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-04-29 18:09:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-29 18:09:58 +0300
commit647de7e6fd971d435396cc8730a2d162240e3d7c (patch)
tree3e2fc4e6e8027375d6061f2ad4badda04ef04476 /spec/workers/gitlab
parent4233d3aa86fe94e6288279aa55d42ed95bfe753c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/gitlab')
-rw-r--r--spec/workers/gitlab/jira_import/import_issue_worker_spec.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb b/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb
index 80629cb875e..36af65a3a06 100644
--- a/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb
+++ b/spec/workers/gitlab/jira_import/import_issue_worker_spec.rb
@@ -5,6 +5,8 @@ require 'spec_helper'
describe Gitlab::JiraImport::ImportIssueWorker do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
+ let_it_be(:jira_issue_label_1) { create(:label, project: project) }
+ let_it_be(:jira_issue_label_2) { create(:label, project: project) }
let(:some_key) { 'some-key' }
describe 'modules' do
@@ -17,7 +19,10 @@ describe Gitlab::JiraImport::ImportIssueWorker do
subject { described_class.new }
describe '#perform', :clean_gitlab_redis_cache do
- let(:issue_attrs) { build(:issue, project_id: project.id).as_json.compact }
+ let(:issue_attrs) do
+ build(:issue, project_id: project.id, title: 'jira issue')
+ .as_json.merge('label_ids' => [jira_issue_label_1.id, jira_issue_label_2.id]).compact
+ end
context 'when any exception raised while inserting to DB' do
before do
@@ -47,14 +52,22 @@ describe Gitlab::JiraImport::ImportIssueWorker do
context 'when import label exists' do
before do
Gitlab::JiraImport.cache_import_label_id(project.id, label.id)
- end
- it 'does not record import failure' do
subject.perform(project.id, 123, issue_attrs, some_key)
+ end
+ it 'does not record import failure' do
expect(label.issues.count).to eq(1)
expect(Gitlab::Cache::Import::Caching.read(Gitlab::JiraImport.failed_issues_counter_cache_key(project.id)).to_i).to eq(0)
end
+
+ it 'creates an issue with the correct attributes' do
+ issue = Issue.last
+
+ expect(issue.title).to eq('jira issue')
+ expect(issue.project).to eq(project)
+ expect(issue.labels).to match_array([label, jira_issue_label_1, jira_issue_label_2])
+ end
end
end
end