summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/build_coverage_worker_spec.rb8
-rw-r--r--spec/workers/build_finished_worker_spec.rb20
-rw-r--r--spec/workers/build_hooks_worker_spec.rb8
-rw-r--r--spec/workers/build_success_worker_spec.rb12
-rw-r--r--spec/workers/delete_user_worker_spec.rb8
-rw-r--r--spec/workers/every_sidekiq_worker_spec.rb10
-rw-r--r--spec/workers/git_garbage_collect_worker_spec.rb4
-rw-r--r--spec/workers/new_note_worker_spec.rb4
-rw-r--r--spec/workers/pipeline_hooks_worker_spec.rb8
-rw-r--r--spec/workers/pipeline_notification_worker_spec.rb20
-rw-r--r--spec/workers/pipeline_proccess_worker_spec.rb4
-rw-r--r--spec/workers/pipeline_success_worker_spec.rb4
-rw-r--r--spec/workers/pipeline_update_worker_spec.rb4
-rw-r--r--spec/workers/post_receive_spec.rb6
-rw-r--r--spec/workers/process_commit_worker_spec.rb20
-rw-r--r--spec/workers/project_cache_worker_spec.rb34
-rw-r--r--spec/workers/repository_fork_worker_spec.rb8
-rw-r--r--spec/workers/repository_import_worker_spec.rb8
-rw-r--r--spec/workers/use_key_worker_spec.rb4
19 files changed, 97 insertions, 97 deletions
diff --git a/spec/workers/build_coverage_worker_spec.rb b/spec/workers/build_coverage_worker_spec.rb
index 8ebf00374a1..ba20488f663 100644
--- a/spec/workers/build_coverage_worker_spec.rb
+++ b/spec/workers/build_coverage_worker_spec.rb
@@ -6,8 +6,8 @@ describe BuildCoverageWorker do
let!(:build) { create(:ci_build) }
it 'updates code coverage' do
- expect_any_instance_of(Ci::Build).
- to receive(:update_coverage)
+ expect_any_instance_of(Ci::Build)
+ .to receive(:update_coverage)
described_class.new.perform(build.id)
end
@@ -15,8 +15,8 @@ describe BuildCoverageWorker do
context 'when build does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/build_finished_worker_spec.rb b/spec/workers/build_finished_worker_spec.rb
index f8119913116..2868167c7d4 100644
--- a/spec/workers/build_finished_worker_spec.rb
+++ b/spec/workers/build_finished_worker_spec.rb
@@ -6,15 +6,15 @@ describe BuildFinishedWorker do
let(:build) { create(:ci_build) }
it 'calculates coverage and calls hooks' do
- expect(BuildCoverageWorker).
- to receive(:new).ordered.and_call_original
- expect(BuildHooksWorker).
- to receive(:new).ordered.and_call_original
+ expect(BuildCoverageWorker)
+ .to receive(:new).ordered.and_call_original
+ expect(BuildHooksWorker)
+ .to receive(:new).ordered.and_call_original
- expect_any_instance_of(BuildCoverageWorker).
- to receive(:perform)
- expect_any_instance_of(BuildHooksWorker).
- to receive(:perform)
+ expect_any_instance_of(BuildCoverageWorker)
+ .to receive(:perform)
+ expect_any_instance_of(BuildHooksWorker)
+ .to receive(:perform)
described_class.new.perform(build.id)
end
@@ -22,8 +22,8 @@ describe BuildFinishedWorker do
context 'when build does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/build_hooks_worker_spec.rb b/spec/workers/build_hooks_worker_spec.rb
index 51abc1d89a1..97654a93f5c 100644
--- a/spec/workers/build_hooks_worker_spec.rb
+++ b/spec/workers/build_hooks_worker_spec.rb
@@ -6,8 +6,8 @@ describe BuildHooksWorker do
let!(:build) { create(:ci_build) }
it 'calls build hooks' do
- expect_any_instance_of(Ci::Build).
- to receive(:execute_hooks)
+ expect_any_instance_of(Ci::Build)
+ .to receive(:execute_hooks)
described_class.new.perform(build.id)
end
@@ -15,8 +15,8 @@ describe BuildHooksWorker do
context 'when build does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/build_success_worker_spec.rb b/spec/workers/build_success_worker_spec.rb
index d016ecbb738..dba70883130 100644
--- a/spec/workers/build_success_worker_spec.rb
+++ b/spec/workers/build_success_worker_spec.rb
@@ -7,8 +7,8 @@ describe BuildSuccessWorker do
let!(:build) { create(:ci_build, environment: 'production') }
it 'executes deployment service' do
- expect_any_instance_of(CreateDeploymentService).
- to receive(:execute)
+ expect_any_instance_of(CreateDeploymentService)
+ .to receive(:execute)
described_class.new.perform(build.id)
end
@@ -18,8 +18,8 @@ describe BuildSuccessWorker do
let!(:build) { create(:ci_build, project: nil) }
it 'does not create deployment' do
- expect_any_instance_of(CreateDeploymentService).
- not_to receive(:execute)
+ expect_any_instance_of(CreateDeploymentService)
+ .not_to receive(:execute)
described_class.new.perform(build.id)
end
@@ -28,8 +28,8 @@ describe BuildSuccessWorker do
context 'when build does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/delete_user_worker_spec.rb b/spec/workers/delete_user_worker_spec.rb
index 0765573408c..06b470f68f2 100644
--- a/spec/workers/delete_user_worker_spec.rb
+++ b/spec/workers/delete_user_worker_spec.rb
@@ -5,15 +5,15 @@ describe DeleteUserWorker do
let!(:current_user) { create(:user) }
it "calls the DeleteUserWorker with the params it was given" do
- expect_any_instance_of(Users::DestroyService).to receive(:execute).
- with(user, {})
+ expect_any_instance_of(Users::DestroyService).to receive(:execute)
+ .with(user, {})
DeleteUserWorker.new.perform(current_user.id, user.id)
end
it "uses symbolized keys" do
- expect_any_instance_of(Users::DestroyService).to receive(:execute).
- with(user, test: "test")
+ expect_any_instance_of(Users::DestroyService).to receive(:execute)
+ .with(user, test: "test")
DeleteUserWorker.new.perform(current_user.id, user.id, "test" => "test")
end
diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb
index fc9adf47c1e..30908534eb3 100644
--- a/spec/workers/every_sidekiq_worker_spec.rb
+++ b/spec/workers/every_sidekiq_worker_spec.rb
@@ -5,8 +5,8 @@ describe 'Every Sidekiq worker' do
root = Rails.root.join('app', 'workers')
concerns = root.join('concerns').to_s
- workers = Dir[root.join('**', '*.rb')].
- reject { |path| path.start_with?(concerns) }
+ workers = Dir[root.join('**', '*.rb')]
+ .reject { |path| path.start_with?(concerns) }
workers.map do |path|
ns = Pathname.new(path).relative_path_from(root).to_s.gsub('.rb', '')
@@ -22,9 +22,9 @@ describe 'Every Sidekiq worker' do
end
it 'uses the cronjob queue when the worker runs as a cronjob' do
- cron_workers = Settings.cron_jobs.
- map { |job_name, options| options['job_class'].constantize }.
- to_set
+ cron_workers = Settings.cron_jobs
+ .map { |job_name, options| options['job_class'].constantize }
+ .to_set
workers.each do |worker|
next unless cron_workers.include?(worker)
diff --git a/spec/workers/git_garbage_collect_worker_spec.rb b/spec/workers/git_garbage_collect_worker_spec.rb
index a60af574a08..e4c4a9ac17a 100644
--- a/spec/workers/git_garbage_collect_worker_spec.rb
+++ b/spec/workers/git_garbage_collect_worker_spec.rb
@@ -11,8 +11,8 @@ describe GitGarbageCollectWorker do
describe "#perform" do
it "flushes ref caches when the task is 'gc'" do
expect(subject).to receive(:command).with(:gc).and_return([:the, :command])
- expect(Gitlab::Popen).to receive(:popen).
- with([:the, :command], project.repository.path_to_repo).and_return(["", 0])
+ expect(Gitlab::Popen).to receive(:popen)
+ .with([:the, :command], project.repository.path_to_repo).and_return(["", 0])
expect_any_instance_of(Repository).to receive(:after_create_branch).and_call_original
expect_any_instance_of(Repository).to receive(:branch_names).and_call_original
diff --git a/spec/workers/new_note_worker_spec.rb b/spec/workers/new_note_worker_spec.rb
index 8fdbb35afd0..575361c93d4 100644
--- a/spec/workers/new_note_worker_spec.rb
+++ b/spec/workers/new_note_worker_spec.rb
@@ -24,8 +24,8 @@ describe NewNoteWorker do
let(:unexistent_note_id) { 999 }
it 'logs NewNoteWorker process skipping' do
- expect(Rails.logger).to receive(:error).
- with("NewNoteWorker: couldn't find note with ID=999, skipping job")
+ expect(Rails.logger).to receive(:error)
+ .with("NewNoteWorker: couldn't find note with ID=999, skipping job")
described_class.new.perform(unexistent_note_id)
end
diff --git a/spec/workers/pipeline_hooks_worker_spec.rb b/spec/workers/pipeline_hooks_worker_spec.rb
index 061f4bda36c..035e329839f 100644
--- a/spec/workers/pipeline_hooks_worker_spec.rb
+++ b/spec/workers/pipeline_hooks_worker_spec.rb
@@ -6,8 +6,8 @@ describe PipelineHooksWorker do
let(:pipeline) { create(:ci_pipeline) }
it 'executes hooks for the pipeline' do
- expect_any_instance_of(Ci::Pipeline).
- to receive(:execute_hooks)
+ expect_any_instance_of(Ci::Pipeline)
+ .to receive(:execute_hooks)
described_class.new.perform(pipeline.id)
end
@@ -15,8 +15,8 @@ describe PipelineHooksWorker do
context 'when pipeline does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/pipeline_notification_worker_spec.rb b/spec/workers/pipeline_notification_worker_spec.rb
index 603ae52ed1e..b9bd234d168 100644
--- a/spec/workers/pipeline_notification_worker_spec.rb
+++ b/spec/workers/pipeline_notification_worker_spec.rb
@@ -56,8 +56,8 @@ describe PipelineNotificationWorker do
context 'with success pipeline notification on' do
before do
- watcher.global_notification_setting.
- update(level: 'custom', success_pipeline: true)
+ watcher.global_notification_setting
+ .update(level: 'custom', success_pipeline: true)
end
it_behaves_like 'sending emails'
@@ -67,8 +67,8 @@ describe PipelineNotificationWorker do
let(:receivers) { [pusher] }
before do
- watcher.global_notification_setting.
- update(level: 'custom', success_pipeline: false)
+ watcher.global_notification_setting
+ .update(level: 'custom', success_pipeline: false)
end
it_behaves_like 'sending emails'
@@ -87,8 +87,8 @@ describe PipelineNotificationWorker do
context 'with failed pipeline notification on' do
before do
- watcher.global_notification_setting.
- update(level: 'custom', failed_pipeline: true)
+ watcher.global_notification_setting
+ .update(level: 'custom', failed_pipeline: true)
end
it_behaves_like 'sending emails'
@@ -98,8 +98,8 @@ describe PipelineNotificationWorker do
let(:receivers) { [pusher] }
before do
- watcher.global_notification_setting.
- update(level: 'custom', failed_pipeline: false)
+ watcher.global_notification_setting
+ .update(level: 'custom', failed_pipeline: false)
end
it_behaves_like 'sending emails'
@@ -117,8 +117,8 @@ describe PipelineNotificationWorker do
before do
pipeline.project.team << [watcher, Gitlab::Access::GUEST]
- watcher.global_notification_setting.
- update(level: 'custom', failed_pipeline: true)
+ watcher.global_notification_setting
+ .update(level: 'custom', failed_pipeline: true)
perform_enqueued_jobs do
subject.perform(pipeline.id)
diff --git a/spec/workers/pipeline_proccess_worker_spec.rb b/spec/workers/pipeline_proccess_worker_spec.rb
index fd6ee0714ea..86e9d7f6684 100644
--- a/spec/workers/pipeline_proccess_worker_spec.rb
+++ b/spec/workers/pipeline_proccess_worker_spec.rb
@@ -14,8 +14,8 @@ describe PipelineProcessWorker do
context 'when pipeline does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/pipeline_success_worker_spec.rb b/spec/workers/pipeline_success_worker_spec.rb
index f6c56465feb..d1c84adda6f 100644
--- a/spec/workers/pipeline_success_worker_spec.rb
+++ b/spec/workers/pipeline_success_worker_spec.rb
@@ -16,8 +16,8 @@ describe PipelineSuccessWorker do
context 'when pipeline does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/pipeline_update_worker_spec.rb b/spec/workers/pipeline_update_worker_spec.rb
index 24d78aae112..0b456cfd0da 100644
--- a/spec/workers/pipeline_update_worker_spec.rb
+++ b/spec/workers/pipeline_update_worker_spec.rb
@@ -14,8 +14,8 @@ describe PipelineUpdateWorker do
context 'when pipeline does not exist' do
it 'does not raise exception' do
- expect { described_class.new.perform(123) }.
- not_to raise_error
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
end
end
end
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index 5919b99a6ed..e0bdbab3f15 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -79,9 +79,9 @@ describe PostReceive do
end
it "does not run if the author is not in the project" do
- allow_any_instance_of(Gitlab::GitPostReceive).
- to receive(:identify_using_ssh_key).
- and_return(nil)
+ allow_any_instance_of(Gitlab::GitPostReceive)
+ .to receive(:identify_using_ssh_key)
+ .and_return(nil)
expect(project).not_to receive(:execute_hooks)
diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb
index 75c7fc1efd2..dfa0ffb1314 100644
--- a/spec/workers/process_commit_worker_spec.rb
+++ b/spec/workers/process_commit_worker_spec.rb
@@ -36,11 +36,11 @@ describe ProcessCommitWorker do
describe '#process_commit_message' do
context 'when pushing to the default branch' do
it 'closes issues that should be closed per the commit message' do
- allow(commit).to receive(:safe_message).
- and_return("Closes #{issue.to_reference}")
+ allow(commit).to receive(:safe_message)
+ .and_return("Closes #{issue.to_reference}")
- expect(worker).to receive(:close_issues).
- with(project, user, user, commit, [issue])
+ expect(worker).to receive(:close_issues)
+ .with(project, user, user, commit, [issue])
worker.process_commit_message(project, commit, user, user, true)
end
@@ -48,8 +48,8 @@ describe ProcessCommitWorker do
context 'when pushing to a non-default branch' do
it 'does not close any issues' do
- allow(commit).to receive(:safe_message).
- and_return("Closes #{issue.to_reference}")
+ allow(commit).to receive(:safe_message)
+ .and_return("Closes #{issue.to_reference}")
expect(worker).not_to receive(:close_issues)
@@ -90,8 +90,8 @@ describe ProcessCommitWorker do
describe '#update_issue_metrics' do
it 'updates any existing issue metrics' do
- allow(commit).to receive(:safe_message).
- and_return("Closes #{issue.to_reference}")
+ allow(commit).to receive(:safe_message)
+ .and_return("Closes #{issue.to_reference}")
worker.update_issue_metrics(commit, user)
@@ -109,8 +109,8 @@ describe ProcessCommitWorker do
end
it 'parses date strings into Time instances' do
- commit = worker.
- build_commit(project, id: '123', authored_date: Time.now.to_s)
+ commit = worker
+ .build_commit(project, id: '123', authored_date: Time.now.to_s)
expect(commit.authored_date).to be_an_instance_of(Time)
end
diff --git a/spec/workers/project_cache_worker_spec.rb b/spec/workers/project_cache_worker_spec.rb
index 0fc274f1a01..da9136282e4 100644
--- a/spec/workers/project_cache_worker_spec.rb
+++ b/spec/workers/project_cache_worker_spec.rb
@@ -7,8 +7,8 @@ describe ProjectCacheWorker do
describe '#perform' do
before do
- allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).
- and_return(true)
+ allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain)
+ .and_return(true)
end
context 'with a non-existing project' do
@@ -31,17 +31,17 @@ describe ProjectCacheWorker do
context 'with an existing project' do
it 'updates the project statistics' do
- expect(worker).to receive(:update_statistics).
- with(kind_of(Project), %i(repository_size)).
- and_call_original
+ expect(worker).to receive(:update_statistics)
+ .with(kind_of(Project), %i(repository_size))
+ .and_call_original
worker.perform(project.id, [], %w(repository_size))
end
it 'refreshes the method caches' do
- expect_any_instance_of(Repository).to receive(:refresh_method_caches).
- with(%i(readme)).
- and_call_original
+ expect_any_instance_of(Repository).to receive(:refresh_method_caches)
+ .with(%i(readme))
+ .and_call_original
worker.perform(project.id, %w(readme))
end
@@ -51,9 +51,9 @@ describe ProjectCacheWorker do
describe '#update_statistics' do
context 'when a lease could not be obtained' do
it 'does not update the repository size' do
- allow(worker).to receive(:try_obtain_lease_for).
- with(project.id, :update_statistics).
- and_return(false)
+ allow(worker).to receive(:try_obtain_lease_for)
+ .with(project.id, :update_statistics)
+ .and_return(false)
expect(statistics).not_to receive(:refresh!)
@@ -63,13 +63,13 @@ describe ProjectCacheWorker do
context 'when a lease could be obtained' do
it 'updates the project statistics' do
- allow(worker).to receive(:try_obtain_lease_for).
- with(project.id, :update_statistics).
- and_return(true)
+ allow(worker).to receive(:try_obtain_lease_for)
+ .with(project.id, :update_statistics)
+ .and_return(true)
- expect(statistics).to receive(:refresh!).
- with(only: %i(repository_size)).
- and_call_original
+ expect(statistics).to receive(:refresh!)
+ .with(only: %i(repository_size))
+ .and_call_original
worker.update_statistics(project, %i(repository_size))
end
diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb
index 60605460adb..b9d8af4d8b0 100644
--- a/spec/workers/repository_fork_worker_spec.rb
+++ b/spec/workers/repository_fork_worker_spec.rb
@@ -35,11 +35,11 @@ describe RepositoryForkWorker do
fork_project.namespace.path
).and_return(true)
- expect_any_instance_of(Repository).to receive(:expire_emptiness_caches).
- and_call_original
+ expect_any_instance_of(Repository).to receive(:expire_emptiness_caches)
+ .and_call_original
- expect_any_instance_of(Repository).to receive(:expire_exists_cache).
- and_call_original
+ expect_any_instance_of(Repository).to receive(:expire_exists_cache)
+ .and_call_original
subject.perform(project.id, '/test/path', project.path_with_namespace,
fork_project.namespace.path)
diff --git a/spec/workers/repository_import_worker_spec.rb b/spec/workers/repository_import_worker_spec.rb
index 9b0e6635844..59cb168f51d 100644
--- a/spec/workers/repository_import_worker_spec.rb
+++ b/spec/workers/repository_import_worker_spec.rb
@@ -8,8 +8,8 @@ describe RepositoryImportWorker do
describe '#perform' do
context 'when the import was successful' do
it 'imports a project' do
- expect_any_instance_of(Projects::ImportService).to receive(:execute).
- and_return({ status: :ok })
+ expect_any_instance_of(Projects::ImportService).to receive(:execute)
+ .and_return({ status: :ok })
expect_any_instance_of(Repository).to receive(:expire_emptiness_caches)
expect_any_instance_of(Project).to receive(:import_finish)
@@ -21,8 +21,8 @@ describe RepositoryImportWorker do
context 'when the import has failed' do
it 'hide the credentials that were used in the import URL' do
error = %{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
- expect_any_instance_of(Projects::ImportService).to receive(:execute).
- and_return({ status: :error, message: error })
+ expect_any_instance_of(Projects::ImportService).to receive(:execute)
+ .and_return({ status: :error, message: error })
subject.perform(project.id)
diff --git a/spec/workers/use_key_worker_spec.rb b/spec/workers/use_key_worker_spec.rb
index f8752c42a49..e50c788b82a 100644
--- a/spec/workers/use_key_worker_spec.rb
+++ b/spec/workers/use_key_worker_spec.rb
@@ -8,8 +8,8 @@ describe UseKeyWorker do
current_time = Time.zone.now
Timecop.freeze(current_time) do
- expect { worker.perform(key.id) }.
- to change { key.reload.last_used_at }.from(nil).to be_like_time(current_time)
+ expect { worker.perform(key.id) }
+ .to change { key.reload.last_used_at }.from(nil).to be_like_time(current_time)
end
end