From 081a584a35eb44dafd77d212acd9317a7f1414ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Rodr=C3=ADguez?= Date: Wed, 10 Jan 2018 13:34:31 -0300 Subject: Ensure hooks are deleted regardless of the project forking method --- spec/spec_helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/spec_helper.rb') diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6186fb92bad..85de0a14631 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -100,6 +100,16 @@ RSpec.configure do |config| config.before(:example) do # Skip pre-receive hook check so we can use the web editor and merge. allow_any_instance_of(Gitlab::Git::Hook).to receive(:trigger).and_return([true, nil]) + + allow_any_instance_of(Gitlab::Git::GitlabProjects).to receive(:fork_repository).and_wrap_original do |m, *args| + m.call(*args) + + shard_path, repository_relative_path = args + # We can't leave the hooks in place after a fork, as those would fail in tests + # The "internal" API is not available + FileUtils.rm_rf(File.join(shard_path, repository_relative_path, 'hooks')) + end + # Enable all features by default for testing allow(Feature).to receive(:enabled?) { true } end -- cgit v1.2.3