Commit 9d735dc2 authored by Marko, Peter's avatar Marko, Peter

Ensure ordering for group sorting tests

Instead of manually creating list to compare the test result,
use system sort to assure no errors are introduced.
Signed-off-by: default avatarMarko, Peter <peter.marko@siemens.com>
parent 79033a5f
......@@ -152,7 +152,7 @@ describe API::Groups do
expect(response).to have_gitlab_http_status(200)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(response_groups).to eq([group3.name, group1.name, group4.name])
expect(response_groups).to eq(Group.visible_to_user(user1).order(:name).pluck(:name))
end
it "sorts in descending order when passed" do
......@@ -161,7 +161,7 @@ describe API::Groups do
expect(response).to have_gitlab_http_status(200)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(response_groups).to eq([group4.name, group1.name, group3.name])
expect(response_groups).to eq(Group.visible_to_user(user1).order(name: :desc).pluck(:name))
end
it "sorts by path in order_by param" do
......@@ -170,7 +170,7 @@ describe API::Groups do
expect(response).to have_gitlab_http_status(200)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(response_groups).to eq([group1.name, group4.name, group3.name])
expect(response_groups).to eq(Group.visible_to_user(user1).order(:path).pluck(:name))
end
it "sorts by id in the order_by param" do
......@@ -179,7 +179,7 @@ describe API::Groups do
expect(response).to have_gitlab_http_status(200)
expect(response).to include_pagination_headers
expect(json_response).to be_an Array
expect(response_groups).to eq([group1.name, group3.name, group4.name])
expect(response_groups).to eq(Group.visible_to_user(user1).order(:id).pluck(:name))
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment