RSpec::Matchers.define :gitaly_request_with_path do |storage_name, relative_path|
  match do |actual|
    repository = actual.repository

    repository.storage_name == storage_name &&
      repository.relative_path == relative_path
  end
end

RSpec::Matchers.define :gitaly_request_with_params do |params|
  match do |actual|
    params.reduce(true) { |r, (key, val)| r && actual.send(key) == val }
  end
end

RSpec::Matchers.define :gitaly_request_with_path do |storage_name, relative_path|
  match do |actual|
    repository = actual.repository

    repository.storage_name == storage_name &&
      repository.relative_path == relative_path
  end
end

RSpec::Matchers.define :gitaly_request_with_params do |params|
  match do |actual|
    params.reduce(true) { |r, (key, val)| r && actual[key.to_s] == val }
  end
end

Fix order-dependent Gitaly specs failing
Fix order-dependent Gitaly specs failing

If `spec/tasks/gitlab/cleanup_rake_spec.rb` preceded any of the Gitaly
request specs, it would import the `cleanup.rake` and the global
function `limit`. For some reason, the Protobuf implementation would use
the global function instead of the getter method. For example:

```
def limit
  puts "hi"
end

req = Gitaly::WikiGetAllPagesRequest.new
req.send(:limit)
hi
=> nil
```

To fix this problem, access the field value using the [] operator
instead.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64006
