diff options
Diffstat (limited to 'spec/workers/gitlab/jira_import')
-rw-r--r-- | spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb index 93e2a44223b..5c3c7dcccc1 100644 --- a/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/finish_import_worker_spec.rb @@ -20,7 +20,7 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do end context 'when feature flag enabled' do - let_it_be(:jira_import) { create(:jira_import_state, :scheduled, project: project) } + let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) } before do stub_feature_flags(jira_issue_import: true) @@ -31,15 +31,27 @@ describe Gitlab::JiraImport::Stage::FinishImportWorker do end context 'when import started' do + let_it_be(:import_label) { create(:label, project: project, title: 'jira-import') } + let_it_be(:imported_issues) { create_list(:labeled_issue, 3, project: project, labels: [import_label]) } + before do + expect(Gitlab::JiraImport).to receive(:get_import_label_id).and_return(import_label.id) + expect(Gitlab::JiraImport).to receive(:issue_failures).and_return(2) + jira_import.start! + worker.perform(project.id) end it 'changes import state to finished' do - worker.perform(project.id) - expect(project.jira_import_status).to eq('finished') end + + it 'saves imported issues counts' do + latest_jira_import = project.latest_jira_import + expect(latest_jira_import.total_issue_count).to eq(5) + expect(latest_jira_import.failed_to_import_count).to eq(2) + expect(latest_jira_import.imported_issues_count).to eq(3) + end end end end |