summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-04-08 15:03:34 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2016-04-13 13:45:01 +0200
commitf875189b3962bde6e4b7b8c4ffdd18af83cbc922 (patch)
tree3a97828c01963824d200c85b20195a6f9538fafa /spec
parentbd0be13f5b52b8eaee019d722980b29acbc55b05 (diff)
downloadgitlab-ce-f875189b3962bde6e4b7b8c4ffdd18af83cbc922.tar.gz
API: Ability to subscribe and unsubscribe from a merge request
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/merge_requests_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 25fa30b2f21..b71c72a3829 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -516,6 +516,36 @@ describe API::API, api: true do
end
end
+ describe 'POST :id/merge_requests/:merge_request_id/subscribe' do
+ it 'subscribes to a merge request' do
+ post api("/projects/#{project.id}/merge_requests/#{merge_request.id}/subscribe", admin)
+
+ expect(response.status).to eq(201)
+ expect(json_response['subscribed']).to eq(true)
+ end
+
+ it 'returns 304 if already subscribed' do
+ post api("/projects/#{project.id}/merge_requests/#{merge_request.id}/subscribe", user)
+
+ expect(response.status).to eq(304)
+ end
+ end
+
+ describe 'POST :id/merge_requests/:merge_request_id/unsubscribe' do
+ it 'unsubscribes from a merge request' do
+ post api("/projects/#{project.id}/merge_requests/#{merge_request.id}/unsubscribe", user)
+
+ expect(response.status).to eq(201)
+ expect(json_response['subscribed']).to eq(false)
+ end
+
+ it 'returns 304 if not subscribed' do
+ post api("/projects/#{project.id}/merge_requests/#{merge_request.id}/unsubscribe", admin)
+
+ expect(response.status).to eq(304)
+ end
+ end
+
def mr_with_later_created_and_updated_at_time
merge_request
merge_request.created_at += 1.hour