summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-31 20:30:18 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-07-31 20:33:21 +0800
commitb720c22fb46009acda19b5cd170d3b64227c89b1 (patch)
tree3c757c5b65ded89b39aad7867ebb95ed527478dd /spec/services
parenta9f56ae16873af40c7f1f753aee4528f0fbc2e8d (diff)
downloadgitlab-ce-b720c22fb46009acda19b5cd170d3b64227c89b1.tar.gz
Avoid expect_any_instance_of because it doesn't workavoid-expect_any_instance_of
well with prepend. We need to backport this
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/projects/transfer_service_spec.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index ae32e85b2a7..36db1aab557 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -37,18 +37,18 @@ describe Projects::TransferService do
end
it 'executes system hooks' do
- expect_any_instance_of(described_class).to receive(:execute_system_hooks)
-
- transfer_project(project, user, group)
+ transfer_project(project, user, group) do |service|
+ expect(service).to receive(:execute_system_hooks)
+ end
end
end
context 'when transfer fails' do
let!(:original_path) { project_path(project) }
- def attempt_project_transfer
+ def attempt_project_transfer(&block)
expect do
- transfer_project(project, user, group)
+ transfer_project(project, user, group, &block)
end.to raise_error(ActiveRecord::ActiveRecordError)
end
@@ -80,9 +80,9 @@ describe Projects::TransferService do
end
it "doesn't run system hooks" do
- expect_any_instance_of(described_class).not_to receive(:execute_system_hooks)
-
- attempt_project_transfer
+ attempt_project_transfer do |service|
+ expect(service).not_to receive(:execute_system_hooks)
+ end
end
end
@@ -120,7 +120,11 @@ describe Projects::TransferService do
end
def transfer_project(project, user, new_namespace)
- Projects::TransferService.new(project, user).execute(new_namespace)
+ service = Projects::TransferService.new(project, user)
+
+ yield(service) if block_given?
+
+ service.execute(new_namespace)
end
context 'visibility level' do