diff options
author | Stan Hu <stanhu@gmail.com> | 2018-08-13 15:36:15 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-08-24 05:34:38 -0700 |
commit | 0377c015cf903a1d22d14086e68d1e07fe3c2643 (patch) | |
tree | d0be528c1d6a1fe44aa937fc3aeb1076aa7e3c7c /spec/lib/gitlab/github_import/importer | |
parent | 842377ab3c5b80a3758ad8c36dc3358bd265bc10 (diff) | |
download | gitlab-ce-0377c015cf903a1d22d14086e68d1e07fe3c2643.tar.gz |
Refactor GitHub Importer database helpers into helper methods
This in preparation for addressing idle-in-transaction timeouts for other importers.
Part of #50021
Diffstat (limited to 'spec/lib/gitlab/github_import/importer')
-rw-r--r-- | spec/lib/gitlab/github_import/importer/issue_importer_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/spec/lib/gitlab/github_import/importer/issue_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issue_importer_spec.rb index 3f7a12144d5..65a2e1cb5cb 100644 --- a/spec/lib/gitlab/github_import/importer/issue_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/issue_importer_spec.rb @@ -92,7 +92,7 @@ describe Gitlab::GithubImport::Importer::IssueImporter, :clean_gitlab_redis_cach .with(issue) .and_return([user.id, true]) - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .with( { @@ -121,7 +121,7 @@ describe Gitlab::GithubImport::Importer::IssueImporter, :clean_gitlab_redis_cach .with(issue) .and_return([project.creator_id, false]) - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .with( { @@ -150,7 +150,7 @@ describe Gitlab::GithubImport::Importer::IssueImporter, :clean_gitlab_redis_cach .with(issue) .and_return([user.id, true]) - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .and_raise(ActiveRecord::InvalidForeignKey, 'invalid foreign key') @@ -185,7 +185,7 @@ describe Gitlab::GithubImport::Importer::IssueImporter, :clean_gitlab_redis_cach .and_return([user.id, true]) issue = build_stubbed(:issue, project: project) - allow(Gitlab::GithubImport) + allow(importer) .to receive(:insert_and_return_id) .and_return(issue.id) allow(project.issues).to receive(:find).with(issue.id).and_return(issue) diff --git a/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb index 44c920043b4..25684ea9e2c 100644 --- a/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb @@ -80,7 +80,7 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi end it 'imports the pull request with the pull request author as the merge request author' do - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .with( { @@ -114,7 +114,7 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi it 'triggers internal_id functionality to track greatest iids' do mr = build_stubbed(:merge_request, source_project: project, target_project: project) - allow(Gitlab::GithubImport).to receive(:insert_and_return_id).and_return(mr.id) + allow(importer).to receive(:insert_and_return_id).and_return(mr.id) allow(project.merge_requests).to receive(:find).with(mr.id).and_return(mr) expect(mr).to receive(:ensure_target_project_iid!) @@ -135,7 +135,7 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi .with(pull_request) .and_return(user.id) - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .with( { @@ -181,7 +181,7 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi .to receive(:source_branch) .and_return('master') - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .with( { @@ -219,7 +219,7 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi .with(pull_request) .and_return(user.id) - expect(Gitlab::GithubImport) + expect(importer) .to receive(:insert_and_return_id) .and_raise(ActiveRecord::InvalidForeignKey, 'invalid foreign key') |