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
diff options
context:
space:
mode:
authorMark Fletcher <mark@gitlab.com>2017-02-15 16:24:18 +0300
committerMark Fletcher <mark@gitlab.com>2017-02-15 16:26:57 +0300
commit7a8d0aab61fa5d59a4bde5330948f1adcfbb542c (patch)
tree93ad521209554a436bbc8cfa00c6128514fe7267 /spec/requests/api/commits_spec.rb
parent865e3fcc13834a1503b8a6c3f7cc7826bacdcc9f (diff)
Ensure only commit comments relevant to target project are returned
Diffstat (limited to 'spec/requests/api/commits_spec.rb')
-rw-r--r--spec/requests/api/commits_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb
index af9028a8978..cb11cf98bf4 100644
--- a/spec/requests/api/commits_spec.rb
+++ b/spec/requests/api/commits_spec.rb
@@ -464,6 +464,20 @@ describe API::Commits, api: true do
expect(response).to have_http_status(401)
end
end
+
+ context 'when the commit is present on two projects' do
+ let(:forked_project) { create(:project, :repository, creator: user2, namespace: user2.namespace) }
+ let!(:forked_project_note) { create(:note_on_commit, author: user2, project: forked_project, commit_id: forked_project.repository.commit.id, note: 'a comment on a commit for fork') }
+
+ it 'returns the comments for the target project' do
+ get api("/projects/#{forked_project.id}/repository/commits/#{forked_project.repository.commit.id}/comments", user2)
+
+ expect(response).to have_http_status(200)
+ expect(json_response.length).to eq(1)
+ expect(json_response.first['note']).to eq('a comment on a commit for fork')
+ expect(json_response.first['author']['id']).to eq(user2.id)
+ end
+ end
end
describe 'POST :id/repository/commits/:sha/cherry_pick' do