diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-28 09:09:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-28 09:09:28 +0300 |
commit | bde0c40776f2152496c37239afe987f13d486314 (patch) | |
tree | fa0b6868303d5ffbc1f45f10a0308afb5205d531 /spec/workers | |
parent | b92f8e2dd441f120e3c8435d7ec9259634e02849 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
3 files changed, 59 insertions, 1 deletions
diff --git a/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb b/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb new file mode 100644 index 00000000000..c799c676300 --- /dev/null +++ b/spec/workers/gitlab/github_import/import_pull_request_merged_by_worker_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::GithubImport::ImportPullRequestMergedByWorker do + it { is_expected.to include_module(Gitlab::GithubImport::ObjectImporter) } + + describe '#representation_class' do + it { expect(subject.representation_class).to eq(Gitlab::GithubImport::Representation::PullRequest) } + end + + describe '#importer_class' do + it { expect(subject.importer_class).to eq(Gitlab::GithubImport::Importer::PullRequestMergedByImporter) } + end + + describe '#counter_name' do + it { expect(subject.counter_name).to eq(:github_importer_imported_pull_requests_merged_by) } + end + + describe '#counter_description' do + it { expect(subject.counter_description).to eq('The number of imported GitHub pull requests merged by') } + end +end diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb new file mode 100644 index 00000000000..2538aafca68 --- /dev/null +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker do + let(:project) { create(:project) } + let(:import_state) { create(:import_state, project: project) } + let(:worker) { described_class.new } + + describe '#import' do + it 'imports all the pull requests' do + importer = double(:importer) + client = double(:client) + waiter = Gitlab::JobWaiter.new(2, '123') + + expect(Gitlab::GithubImport::Importer::PullRequestsMergedByImporter) + .to receive(:new) + .with(project, client) + .and_return(importer) + + expect(importer) + .to receive(:execute) + .and_return(waiter) + + expect(import_state) + .to receive(:refresh_jid_expiration) + + expect(Gitlab::GithubImport::AdvanceStageWorker) + .to receive(:perform_async) + .with(project.id, { '123' => 2 }, :issues_and_diff_notes) + + worker.import(client, project) + end + end +end diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb index 0acbca7032c..29578f9bf37 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker do expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :issues_and_diff_notes) + .with(project.id, { '123' => 2 }, :pull_requests_merged_by) worker.import(client, project) end |