summaryrefslogtreecommitdiff
path: root/spec/models/network/graph_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/network/graph_spec.rb')
-rw-r--r--spec/models/network/graph_spec.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/spec/models/network/graph_spec.rb b/spec/models/network/graph_spec.rb
index a393aace39c..16894bf28f1 100644
--- a/spec/models/network/graph_spec.rb
+++ b/spec/models/network/graph_spec.rb
@@ -6,10 +6,24 @@ RSpec.describe Network::Graph do
let(:project) { create(:project, :repository) }
let!(:note_on_commit) { create(:note_on_commit, project: project) }
- it '#initialize' do
- graph = described_class.new(project, 'refs/heads/master', project.repository.commit, nil)
+ describe '#initialize' do
+ let(:graph) do
+ described_class.new(project, 'refs/heads/master', project.repository.commit, nil)
+ end
+
+ it 'has initialized' do
+ expect(graph).to be_a(described_class)
+ end
- expect(graph.notes).to eq( { note_on_commit.commit_id => 1 } )
+ context 'when disable_network_graph_note_counts is disabled' do
+ before do
+ stub_feature_flags(disable_network_graph_notes_count: false)
+ end
+
+ it 'initializes the notes hash' do
+ expect(graph.notes).to eq({ note_on_commit.commit_id => 1 })
+ end
+ end
end
describe '#commits' do
@@ -19,7 +33,7 @@ RSpec.describe Network::Graph do
commits = graph.commits
expect(commits).not_to be_empty
- expect(commits).to all( be_kind_of(Network::Commit) )
+ expect(commits).to all(be_kind_of(Network::Commit))
end
it 'sorts commits by commit date (descending)' do
@@ -42,7 +56,7 @@ RSpec.describe Network::Graph do
parent_indexes = commit.parent_ids.map { |parent_id| commit_ids.find_index(parent_id) }.compact
# All parents of the current commit should appear after it
- expect(parent_indexes).to all( be > index )
+ expect(parent_indexes).to all(be > index)
end
end
end