summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-10-24 15:25:37 +0200
committerRémy Coutable <remy@rymai.me>2016-10-24 15:25:37 +0200
commit0e43e34b45c6e1de68e65c8a51df078e850ec2c6 (patch)
tree09a1574a9a946ff7f3478bcd6665316e43f63789 /spec
parent1f84dbaa9a56dd884240c8c4558163c74f53b413 (diff)
parentea6c5c1c0ee8f09fff4dbf02d7bfb65107020996 (diff)
downloadgitlab-ce-0e43e34b45c6e1de68e65c8a51df078e850ec2c6.tar.gz
Merge branch 'barthc/gitlab-ce-prevent_authored_vote_from_notes'
See merge request !6544.
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/notes_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb
index d58bedc3bf7..0124b7271b3 100644
--- a/spec/requests/api/notes_spec.rb
+++ b/spec/requests/api/notes_spec.rb
@@ -221,12 +221,23 @@ describe API::API, api: true do
end
end
- context 'when the user is posting an award emoji' do
+ context 'when the user is posting an award emoji on an issue created by someone else' do
+ let(:issue2) { create(:issue, project: project) }
+
it 'returns an award emoji' do
+ post api("/projects/#{project.id}/issues/#{issue2.id}/notes", user), body: ':+1:'
+
+ expect(response).to have_http_status(201)
+ expect(json_response['awardable_id']).to eq issue2.id
+ end
+ end
+
+ context 'when the user is posting an award emoji on his/her own issue' do
+ it 'creates a new issue note' do
post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: ':+1:'
expect(response).to have_http_status(201)
- expect(json_response['awardable_id']).to eq issue.id
+ expect(json_response['body']).to eq(':+1:')
end
end
end