diff options
author | Stuart Pook <s.pook@criteo.com> | 2014-03-19 22:07:51 +0400 |
---|---|---|
committer | Stuart Pook <s.pook@criteo.com> | 2014-03-19 22:07:51 +0400 |
commit | 9886998f24b3d6e44aafc412b87980cb1755544c (patch) | |
tree | d50b83e7b30b341006f63e7f41046228a077e4ea /spec | |
parent | ad3acff40990edf0ea3a380b8aa862098612f06a (diff) |
Add method to get the comments on a merge request
Add method to get the comments for a merge request and
document that you can change the status of a merge request.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 1a9e4809e7d..138f218d46c 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -7,6 +7,7 @@ describe API::API do let(:user) { create(:user) } let!(:project) {create(:project, creator_id: user.id, namespace: user.namespace) } let!(:merge_request) { create(:merge_request, author: user, assignee: user, source_project: project, target_project: project, title: "Test") } + let!(:note) { create(:note_on_merge_request, author: user, project: project, noteable: merge_request, note: "a comment on a MR") } before { project.team << [user, :reporters] } @@ -205,4 +206,20 @@ describe API::API do response.status.should == 404 end end + + describe "GET :id/merge_request/:merge_request_id/comments" do + it "should return merge_request comments" do + get api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user) + response.status.should == 200 + json_response.should be_an Array + json_response.length.should == 1 + json_response.first['note'].should == "a comment on a MR" + json_response.first['author']['id'].should == user.id + end + + it "should return a 404 error if merge_request_id not found" do + get api("/projects/#{project.id}/merge_request/999/comments", user) + response.status.should == 404 + end + end end |