gitlab-org--gitlab-foss/spec/helpers/graph_helper_spec.rb
Zeger-Jan van de Weg 73e78c4e15
Don't use rugged in Repository#refs_hash
The refs hash is used to determine what branches and tags have a commit
as head in the network graph. The previous implementation depended on
Rugged#references. The problem with this implementation was that it
depended on rugged, but also that it iterated over all references and
thus loading more data than needed if for example the project uses CI/CD
environments, Pipelines, or Merge Requests.

Given only refs are checked the network cares about the GraphHelper#refs
method has no need to reject those, simplifying the method.

Closes gitlab-org/gitaly#880
2018-02-07 15:07:03 +01:00

16 lines
439 B
Ruby

require 'spec_helper'
describe GraphHelper do
describe '#get_refs' do
let(:project) { create(:project, :repository) }
let(:commit) { project.commit("master") }
let(:graph) { Network::Graph.new(project, 'master', commit, '') }
it 'filters our refs used by GitLab' do
self.instance_variable_set(:@graph, graph)
refs = refs(project.repository, commit)
expect(refs).to match('master')
end
end
end