diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb')
-rw-r--r-- | spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb | 66 |
1 files changed, 27 insertions, 39 deletions
diff --git a/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb b/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb index f2067522af4..40f6cf75412 100644 --- a/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb +++ b/spec/workers/gitlab/jira_import/stage/import_issues_worker_spec.rb @@ -13,65 +13,53 @@ describe Gitlab::JiraImport::Stage::ImportIssuesWorker do end describe '#perform' do - context 'when feature flag disabled' do - before do - stub_feature_flags(jira_issue_import: false) - end + let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) } + + before do + stub_jira_service_test + end + context 'when import did not start' do it_behaves_like 'cannot do Jira import' it_behaves_like 'does not advance to next stage' end - context 'when feature flag enabled' do - let_it_be(:jira_import, reload: true) { create(:jira_import_state, :scheduled, project: project) } + context 'when import started', :clean_gitlab_redis_cache do + let_it_be(:jira_service) { create(:jira_service, project: project) } before do - stub_feature_flags(jira_issue_import: true) - stub_jira_service_test + jira_import.start! + allow_next_instance_of(Gitlab::JiraImport::IssuesImporter) do |instance| + allow(instance).to receive(:fetch_issues).and_return([]) + end end - context 'when import did not start' do - it_behaves_like 'cannot do Jira import' - it_behaves_like 'does not advance to next stage' + context 'when start_at is nil' do + it_behaves_like 'advance to next stage', :attachments end - context 'when import started', :clean_gitlab_redis_cache do - let_it_be(:jira_service) { create(:jira_service, project: project) } - + context 'when start_at is zero' do before do - jira_import.start! - allow_next_instance_of(Gitlab::JiraImport::IssuesImporter) do |instance| - allow(instance).to receive(:fetch_issues).and_return([]) - end - end - - context 'when start_at is nil' do - it_behaves_like 'advance to next stage', :attachments + allow(Gitlab::Cache::Import::Caching).to receive(:read).and_return(0) end - context 'when start_at is zero' do - before do - allow(Gitlab::Cache::Import::Caching).to receive(:read).and_return(0) - end + it_behaves_like 'advance to next stage', :issues + end - it_behaves_like 'advance to next stage', :issues + context 'when start_at is greater than zero' do + before do + allow(Gitlab::Cache::Import::Caching).to receive(:read).and_return(25) end - context 'when start_at is greater than zero' do - before do - allow(Gitlab::Cache::Import::Caching).to receive(:read).and_return(25) - end + it_behaves_like 'advance to next stage', :issues + end - it_behaves_like 'advance to next stage', :issues + context 'when start_at is below zero' do + before do + allow(Gitlab::Cache::Import::Caching).to receive(:read).and_return(-1) end - context 'when start_at is below zero' do - before do - allow(Gitlab::Cache::Import::Caching).to receive(:read).and_return(-1) - end - - it_behaves_like 'advance to next stage', :attachments - end + it_behaves_like 'advance to next stage', :attachments end end end |