diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-05-02 22:30:30 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-05-02 22:30:30 +0000 |
commit | 2a73f0a638d4268dd367346dd602910f777742f4 (patch) | |
tree | f73ca298187d04074b98b6e3c02c2e8a7c23d671 /spec/workers | |
parent | 920d55b9f8afd35e16351fb57d671acf66092e89 (diff) | |
parent | d49768296ce596bbbbdf8412c362d9999ce822a4 (diff) | |
download | gitlab-ce-2a73f0a638d4268dd367346dd602910f777742f4.tar.gz |
Merge branch 'rs-described_class-cop-2' into 'master'
Enable `RSpec/DescribedClass` cop and correct violations
See merge request !10930
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/delete_user_worker_spec.rb | 4 | ||||
-rw-r--r-- | spec/workers/emails_on_push_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/git_garbage_collect_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/gitlab_usage_ping_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/group_destroy_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/merge_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/post_receive_spec.rb | 18 | ||||
-rw-r--r-- | spec/workers/project_destroy_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/remove_expired_members_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb | 2 | ||||
-rw-r--r-- | spec/workers/repository_fork_worker_spec.rb | 2 |
11 files changed, 20 insertions, 20 deletions
diff --git a/spec/workers/delete_user_worker_spec.rb b/spec/workers/delete_user_worker_spec.rb index 0765573408c..5912dd76262 100644 --- a/spec/workers/delete_user_worker_spec.rb +++ b/spec/workers/delete_user_worker_spec.rb @@ -8,13 +8,13 @@ describe DeleteUserWorker do expect_any_instance_of(Users::DestroyService).to receive(:execute). with(user, {}) - DeleteUserWorker.new.perform(current_user.id, user.id) + described_class.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") - DeleteUserWorker.new.perform(current_user.id, user.id, "test" => "test") + described_class.new.perform(current_user.id, user.id, "test" => "test") end end diff --git a/spec/workers/emails_on_push_worker_spec.rb b/spec/workers/emails_on_push_worker_spec.rb index 8cf2b888f9a..a0ed85cc0b3 100644 --- a/spec/workers/emails_on_push_worker_spec.rb +++ b/spec/workers/emails_on_push_worker_spec.rb @@ -12,7 +12,7 @@ describe EmailsOnPushWorker do let(:perform) { subject.perform(project.id, recipients, data.stringify_keys) } let(:email) { ActionMailer::Base.deliveries.last } - subject { EmailsOnPushWorker.new } + subject { described_class.new } describe "#perform" do context "when push is a new branch" do diff --git a/spec/workers/git_garbage_collect_worker_spec.rb b/spec/workers/git_garbage_collect_worker_spec.rb index 029f35512e0..7a590f64e3c 100644 --- a/spec/workers/git_garbage_collect_worker_spec.rb +++ b/spec/workers/git_garbage_collect_worker_spec.rb @@ -6,7 +6,7 @@ describe GitGarbageCollectWorker do let(:project) { create(:project, :repository) } let(:shell) { Gitlab::Shell.new } - subject { GitGarbageCollectWorker.new } + subject { described_class.new } describe "#perform" do it "flushes ref caches when the task is 'gc'" do diff --git a/spec/workers/gitlab_usage_ping_worker_spec.rb b/spec/workers/gitlab_usage_ping_worker_spec.rb index b6c080f36f4..26241044533 100644 --- a/spec/workers/gitlab_usage_ping_worker_spec.rb +++ b/spec/workers/gitlab_usage_ping_worker_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe GitlabUsagePingWorker do - subject { GitlabUsagePingWorker.new } + subject { described_class.new } it "sends POST request" do stub_application_setting(usage_ping_enabled: true) diff --git a/spec/workers/group_destroy_worker_spec.rb b/spec/workers/group_destroy_worker_spec.rb index 1ff5a3b9034..c78efc67076 100644 --- a/spec/workers/group_destroy_worker_spec.rb +++ b/spec/workers/group_destroy_worker_spec.rb @@ -5,7 +5,7 @@ describe GroupDestroyWorker do let(:user) { create(:admin) } let!(:project) { create(:empty_project, namespace: group) } - subject { GroupDestroyWorker.new } + subject { described_class.new } describe "#perform" do it "deletes the project" do diff --git a/spec/workers/merge_worker_spec.rb b/spec/workers/merge_worker_spec.rb index b5e1fdb8ded..303193bab9b 100644 --- a/spec/workers/merge_worker_spec.rb +++ b/spec/workers/merge_worker_spec.rb @@ -15,7 +15,7 @@ describe MergeWorker do it 'clears cache of source repo after removing source branch' do expect(source_project.repository.branch_names).to include('markdown') - MergeWorker.new.perform( + described_class.new.perform( merge_request.id, merge_request.author_id, commit_message: 'wow such merge', should_remove_source_branch: true) diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index a2a559a2369..5ab3c4a0e34 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -10,7 +10,7 @@ describe PostReceive do context "as a resque worker" do it "reponds to #perform" do - expect(PostReceive.new).to respond_to(:perform) + expect(described_class.new).to respond_to(:perform) end end @@ -25,7 +25,7 @@ describe PostReceive do it "calls GitTagPushService" do expect_any_instance_of(GitPushService).to receive(:execute).and_return(true) expect_any_instance_of(GitTagPushService).not_to receive(:execute) - PostReceive.new.perform(pwd(project), key_id, base64_changes) + described_class.new.perform(pwd(project), key_id, base64_changes) end end @@ -35,7 +35,7 @@ describe PostReceive do it "calls GitTagPushService" do expect_any_instance_of(GitPushService).not_to receive(:execute) expect_any_instance_of(GitTagPushService).to receive(:execute).and_return(true) - PostReceive.new.perform(pwd(project), key_id, base64_changes) + described_class.new.perform(pwd(project), key_id, base64_changes) end end @@ -45,12 +45,12 @@ describe PostReceive do it "does not call any of the services" do expect_any_instance_of(GitPushService).not_to receive(:execute) expect_any_instance_of(GitTagPushService).not_to receive(:execute) - PostReceive.new.perform(pwd(project), key_id, base64_changes) + described_class.new.perform(pwd(project), key_id, base64_changes) end end context "gitlab-ci.yml" do - subject { PostReceive.new.perform(pwd(project), key_id, base64_changes) } + subject { described_class.new.perform(pwd(project), key_id, base64_changes) } context "creates a Ci::Pipeline for every change" do before do @@ -75,7 +75,7 @@ describe PostReceive do context "webhook" do it "fetches the correct project" do expect(Project).to receive(:find_by_full_path).with(project.path_with_namespace).and_return(project) - PostReceive.new.perform(pwd(project), key_id, base64_changes) + described_class.new.perform(pwd(project), key_id, base64_changes) end it "does not run if the author is not in the project" do @@ -85,7 +85,7 @@ describe PostReceive do expect(project).not_to receive(:execute_hooks) - expect(PostReceive.new.perform(pwd(project), key_id, base64_changes)).to be_falsey + expect(described_class.new.perform(pwd(project), key_id, base64_changes)).to be_falsey end it "asks the project to trigger all hooks" do @@ -93,14 +93,14 @@ describe PostReceive do expect(project).to receive(:execute_hooks).twice expect(project).to receive(:execute_services).twice - PostReceive.new.perform(pwd(project), key_id, base64_changes) + described_class.new.perform(pwd(project), key_id, base64_changes) end it "enqueues a UpdateMergeRequestsWorker job" do allow(Project).to receive(:find_by_full_path).and_return(project) expect(UpdateMergeRequestsWorker).to receive(:perform_async).with(project.id, project.owner.id, any_args) - PostReceive.new.perform(pwd(project), key_id, base64_changes) + described_class.new.perform(pwd(project), key_id, base64_changes) end end diff --git a/spec/workers/project_destroy_worker_spec.rb b/spec/workers/project_destroy_worker_spec.rb index 0ab42f99510..3d135f40c1f 100644 --- a/spec/workers/project_destroy_worker_spec.rb +++ b/spec/workers/project_destroy_worker_spec.rb @@ -4,7 +4,7 @@ describe ProjectDestroyWorker do let(:project) { create(:project, :repository) } let(:path) { project.repository.path_to_repo } - subject { ProjectDestroyWorker.new } + subject { described_class.new } describe "#perform" do it "deletes the project" do diff --git a/spec/workers/remove_expired_members_worker_spec.rb b/spec/workers/remove_expired_members_worker_spec.rb index 402aa1e714e..058fdf4c009 100644 --- a/spec/workers/remove_expired_members_worker_spec.rb +++ b/spec/workers/remove_expired_members_worker_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe RemoveExpiredMembersWorker do - let(:worker) { RemoveExpiredMembersWorker.new } + let(:worker) { described_class.new } describe '#perform' do context 'project members' do diff --git a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb index 6d42946de38..1c183ce54f4 100644 --- a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb +++ b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe RemoveUnreferencedLfsObjectsWorker do - let(:worker) { RemoveUnreferencedLfsObjectsWorker.new } + let(:worker) { described_class.new } describe '#perform' do let!(:unreferenced_lfs_object1) { create(:lfs_object, oid: '1') } diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 7d6a2db2972..5e1cb74c7fc 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -5,7 +5,7 @@ describe RepositoryForkWorker do let(:fork_project) { create(:project, :repository, forked_from_project: project) } let(:shell) { Gitlab::Shell.new } - subject { RepositoryForkWorker.new } + subject { described_class.new } before do allow(subject).to receive(:gitlab_shell).and_return(shell) |