summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-11-20 10:36:52 +0000
committerSean McGivern <sean@gitlab.com>2018-11-20 10:36:52 +0000
commit2742b871fe44c649b4b503d10f5875276fb8fd87 (patch)
tree4c022342bd0b7f2f9464b2fe6ee5a8d1e8a58a34 /spec/support
parent799486373e74711db65c2f77d11b1ec77fd7f4d9 (diff)
downloadgitlab-ce-2742b871fe44c649b4b503d10f5875276fb8fd87.tar.gz
Revert "Merge branch 'zj-improve-gitaly-pb' into 'master'"revert-e2aa2177
This reverts merge request !23140
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/gitaly.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/gitaly.rb b/spec/support/gitaly.rb
new file mode 100644
index 00000000000..614aaa73693
--- /dev/null
+++ b/spec/support/gitaly.rb
@@ -0,0 +1,16 @@
+RSpec.configure do |config|
+ config.before(:each) do |example|
+ if example.metadata[:disable_gitaly]
+ # Use 'and_wrap_original' to make sure the arguments are valid
+ allow(Gitlab::GitalyClient).to receive(:feature_enabled?).and_wrap_original { |m, *args| m.call(*args) && false }
+ else
+ next if example.metadata[:skip_gitaly_mock]
+
+ # Use 'and_wrap_original' to make sure the arguments are valid
+ allow(Gitlab::GitalyClient).to receive(:feature_enabled?).and_wrap_original do |m, *args|
+ m.call(*args)
+ !Gitlab::GitalyClient.explicit_opt_in_required.include?(args.first)
+ end
+ end
+ end
+end