diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-04 21:09:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-04 21:09:57 +0300 |
commit | f5a72705e46f835812ffcc51658eecb08fbdf050 (patch) | |
tree | 9b322ce9c0454759d5b669be56e603a481791388 /spec/workers/concerns | |
parent | 23c4d0c3e1ea30be08b597a961fc91773f60309f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/concerns')
-rw-r--r-- | spec/workers/concerns/gitlab/github_import/object_importer_spec.rb | 111 | ||||
-rw-r--r-- | spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb | 68 |
2 files changed, 82 insertions, 97 deletions
diff --git a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb index ce02100ebfc..ddcf922ad68 100644 --- a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb @@ -60,26 +60,23 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter do expect(importer_instance) .to receive(:execute) - expect_next_instance_of(Gitlab::Import::Logger) do |logger| - expect(logger) - .to receive(:info) - .with( - github_id: 1, - message: 'starting importer', - import_source: :github, - project_id: 1, - importer: 'klass_name' - ) - expect(logger) - .to receive(:info) - .with( - github_id: 1, - message: 'importer finished', - import_source: :github, - project_id: 1, - importer: 'klass_name' - ) - end + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + github_id: 1, + message: 'starting importer', + project_id: 1, + importer: 'klass_name' + ) + + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + github_id: 1, + message: 'importer finished', + project_id: 1, + importer: 'klass_name' + ) worker.import(project, client, { 'number' => 10, 'github_id' => 1 }) @@ -100,31 +97,28 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter do .to receive(:execute) .and_raise(exception) - expect_next_instance_of(Gitlab::Import::Logger) do |logger| - expect(logger) - .to receive(:info) - .with( - github_id: 1, - message: 'starting importer', - import_source: :github, - project_id: project.id, - importer: 'klass_name' - ) - expect(logger) - .to receive(:error) - .with( - github_id: 1, - message: 'importer failed', - import_source: :github, - project_id: project.id, - importer: 'klass_name', - 'error.message': 'some error', - 'github.data': { - 'github_id' => 1, - 'number' => 10 - } - ) - end + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + github_id: 1, + message: 'starting importer', + project_id: project.id, + importer: 'klass_name' + ) + + expect(Gitlab::GithubImport::Logger) + .to receive(:error) + .with( + github_id: 1, + message: 'importer failed', + project_id: project.id, + importer: 'klass_name', + 'error.message': 'some error', + 'github.data': { + 'github_id' => 1, + 'number' => 10 + } + ) expect(Gitlab::ErrorTracking) .to receive(:track_and_raise_exception) @@ -143,21 +137,18 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter do it 'logs error when representation does not have a github_id' do expect(importer_class).not_to receive(:new) - expect_next_instance_of(Gitlab::Import::Logger) do |logger| - expect(logger) - .to receive(:error) - .with( - github_id: nil, - message: 'importer failed', - import_source: :github, - project_id: project.id, - importer: 'klass_name', - 'error.message': 'key not found: :github_id', - 'github.data': { - 'number' => 10 - } - ) - end + expect(Gitlab::GithubImport::Logger) + .to receive(:error) + .with( + github_id: nil, + message: 'importer failed', + project_id: project.id, + importer: 'klass_name', + 'error.message': 'key not found: :github_id', + 'github.data': { + 'number' => 10 + } + ) expect(Gitlab::ErrorTracking) .to receive(:track_and_raise_exception) diff --git a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb index 651ea77a71c..c0e2df6f985 100644 --- a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb @@ -36,24 +36,21 @@ RSpec.describe Gitlab::GithubImport::StageMethods do an_instance_of(Project) ) - expect_next_instance_of(Gitlab::Import::Logger) do |logger| - expect(logger) - .to receive(:info) - .with( - message: 'starting stage', - import_source: :github, - project_id: project.id, - import_stage: 'DummyStage' - ) - expect(logger) - .to receive(:info) - .with( - message: 'stage finished', - import_source: :github, - project_id: project.id, - import_stage: 'DummyStage' - ) - end + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + message: 'starting stage', + project_id: project.id, + import_stage: 'DummyStage' + ) + + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + message: 'stage finished', + project_id: project.id, + import_stage: 'DummyStage' + ) worker.perform(project.id) end @@ -70,25 +67,22 @@ RSpec.describe Gitlab::GithubImport::StageMethods do .to receive(:try_import) .and_raise(exception) - expect_next_instance_of(Gitlab::Import::Logger) do |logger| - expect(logger) - .to receive(:info) - .with( - message: 'starting stage', - import_source: :github, - project_id: project.id, - import_stage: 'DummyStage' - ) - expect(logger) - .to receive(:error) - .with( - message: 'stage failed', - import_source: :github, - project_id: project.id, - import_stage: 'DummyStage', - 'error.message': 'some error' - ) - end + expect(Gitlab::GithubImport::Logger) + .to receive(:info) + .with( + message: 'starting stage', + project_id: project.id, + import_stage: 'DummyStage' + ) + + expect(Gitlab::GithubImport::Logger) + .to receive(:error) + .with( + message: 'stage failed', + project_id: project.id, + import_stage: 'DummyStage', + 'error.message': 'some error' + ) expect(Gitlab::ErrorTracking) .to receive(:track_and_raise_exception) |