Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRubén Dávila Santos <ruben@gitlab.com>2016-08-20 21:03:23 +0300
committerRuben Davila <rdavila84@gmail.com>2016-08-20 21:06:04 +0300
commit707bb9dcad5daf2b8f1dfdfd62fc2c4280497a4b (patch)
tree46d9e23f56acf280aa80d1e86484aada1f8e5a4d /spec
parent8df13ef69a049f33a3d9f97070ee224cbde5d910 (diff)
Merge branch 'fix-network-graph-error-500' into 'master'
Fix Error 500 resulting when loading network graph `discussion_id` may not be present when the SELECT call for notes does not include this attribute. Don't attempt to set the discussion ID unless the model contains the attribute: ```ruby irb(main):019:0> notes[0] Note Load (10.3ms) SELECT notes.commit_id, count(notes.id) as note_count FROM "notes" WHERE "notes"."project_id" = $1 AND (noteable_type = 'Commit') GROUP BY notes.commit_id [["project_id", 13083]] ActiveModel::MissingAttributeError: missing attribute: discussion_id ``` Closes #21119, #21128 See merge request !5922
Diffstat (limited to 'spec')
-rw-r--r--spec/models/network/graph_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/network/graph_spec.rb b/spec/models/network/graph_spec.rb
new file mode 100644
index 00000000000..b76513d2a3c
--- /dev/null
+++ b/spec/models/network/graph_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe Network::Graph, models: true do
+ let(:project) { create(:project) }
+ 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)
+
+ expect(graph.notes).to eq( { note_on_commit.commit_id => 1 } )
+ end
+end