diff options
author | Marko, Peter <peter.marko@siemens.com> | 2018-06-14 23:45:17 +0200 |
---|---|---|
committer | Marko, Peter <peter.marko@siemens.com> | 2018-06-15 12:11:33 +0200 |
commit | 9d735dc27c09f0d9ce50711dbf99ddd8514f75b9 (patch) | |
tree | 9fa1ddb7cc26931a0b035bf1ece43b78310e74a1 /spec | |
parent | 79033a5f678c05c640d0b0cb7b53909ae2b5e221 (diff) | |
download | gitlab-ce-9d735dc27c09f0d9ce50711dbf99ddd8514f75b9.tar.gz |
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: Marko, Peter <peter.marko@siemens.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/groups_spec.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 2e7a5cbeca6..f5218ebfac2 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -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 |