diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-07-28 09:15:08 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-07-28 09:15:08 +0000 |
commit | 43d118803133558209973464b1c16fd4c7ba446c (patch) | |
tree | f20b88da29bca8ef6df2c5fa8207d8b45244c8d6 /spec | |
parent | 4fae34d6297756d11585dcbef45d03cc39eeb125 (diff) | |
parent | 6c9f527b3f3f0c47438e0722792ca247a44e4964 (diff) | |
download | gitlab-ce-43d118803133558209973464b1c16fd4c7ba446c.tar.gz |
Merge branch 'fix-api-mr-notes-ordering' into 'master'
Return comments in created order in merge request API
Closes #1832
See merge request !985
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 7030c105b58..29db035b2de 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -8,6 +8,7 @@ describe API::API, api: true do let!(:merge_request_closed) { create(:merge_request, state: "closed", author: user, assignee: user, source_project: project, target_project: project, title: "Closed test") } let!(:merge_request_merged) { create(:merge_request, state: "merged", author: user, assignee: user, source_project: project, target_project: project, title: "Merged test") } let!(:note) { create(:note_on_merge_request, author: user, project: project, noteable: merge_request, note: "a comment on a MR") } + let!(:note2) { create(:note_on_merge_request, author: user, project: project, noteable: merge_request, note: "another comment on a MR") } before do project.team << [user, :reporters] @@ -397,13 +398,14 @@ describe API::API, api: true do end describe "GET :id/merge_request/:merge_request_id/comments" do - it "should return merge_request comments" do + it "should return merge_request comments ordered by created_at" do get api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user) expect(response.status).to eq(200) expect(json_response).to be_an Array - expect(json_response.length).to eq(1) + expect(json_response.length).to eq(2) expect(json_response.first['note']).to eq("a comment on a MR") expect(json_response.first['author']['id']).to eq(user.id) + expect(json_response.last['note']).to eq("another comment on a MR") end it "should return a 404 error if merge_request_id not found" do |