summaryrefslogtreecommitdiff
path: root/spec/support/gitaly.rb
blob: 5a1dd44bc9d46018f206db0599bcfa0ea5d18c58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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