diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb')
-rw-r--r-- | spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb index f2a28ec40b8..c0dd4f488cc 100644 --- a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker do it 'imports the issues and diff notes' do client = double(:client) - described_class::IMPORTERS.each do |klass| + worker.importers(project).each do |klass| importer = double(:importer) waiter = Gitlab::JobWaiter.new(2, '123') @@ -31,4 +31,45 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker do worker.import(client, project) end end + + describe '#importers' do + context 'when project group is present' do + let_it_be(:project) { create(:project) } + let_it_be(:group) { create(:group, projects: [project]) } + + context 'when feature flag github_importer_single_endpoint_notes_import is enabled' do + it 'includes single endpoint diff notes importer' do + project = create(:project) + group = create(:group, projects: [project]) + + stub_feature_flags(github_importer_single_endpoint_notes_import: group) + + expect(worker.importers(project)).to contain_exactly( + Gitlab::GithubImport::Importer::IssuesImporter, + Gitlab::GithubImport::Importer::SingleEndpointDiffNotesImporter + ) + end + end + + context 'when feature flag github_importer_single_endpoint_notes_import is disabled' do + it 'includes default diff notes importer' do + stub_feature_flags(github_importer_single_endpoint_notes_import: false) + + expect(worker.importers(project)).to contain_exactly( + Gitlab::GithubImport::Importer::IssuesImporter, + Gitlab::GithubImport::Importer::DiffNotesImporter + ) + end + end + end + + context 'when project group is missing' do + it 'includes default diff notes importer' do + expect(worker.importers(project)).to contain_exactly( + Gitlab::GithubImport::Importer::IssuesImporter, + Gitlab::GithubImport::Importer::DiffNotesImporter + ) + end + end + end end |