diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 00:08:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 00:08:48 +0300 |
commit | a89cb5cbdd832d4d9e80517973aceda6bc0a3856 (patch) | |
tree | 574475bd0901a2f8906d36a4728b8bbb95b41e1c /spec/requests | |
parent | 0d6fa033121a9bef708b8f2de186c4034c61d4a3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/graphql_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/issues/get_group_issues_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/protected_branches_spec.rb | 18 | ||||
-rw-r--r-- | spec/requests/api/users_spec.rb | 20 |
5 files changed, 36 insertions, 8 deletions
diff --git a/spec/requests/api/graphql_spec.rb b/spec/requests/api/graphql_spec.rb index d0378278600..cad9329fcb8 100644 --- a/spec/requests/api/graphql_spec.rb +++ b/spec/requests/api/graphql_spec.rb @@ -46,7 +46,7 @@ describe 'GraphQL' do end it 'logs the exception in Sentry and continues with the request' do - expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).at_least(1).times + expect(Gitlab::ErrorTracking).to receive(:track_and_raise_for_dev_exception).at_least(:once) expect(Gitlab::GraphqlLogger).to receive(:info) post_graphql(query, variables: {}) diff --git a/spec/requests/api/issues/get_group_issues_spec.rb b/spec/requests/api/issues/get_group_issues_spec.rb index ef63902ffd7..f2a1b335589 100644 --- a/spec/requests/api/issues/get_group_issues_spec.rb +++ b/spec/requests/api/issues/get_group_issues_spec.rb @@ -689,7 +689,7 @@ describe API::Issues do end end - context "#to_reference" do + describe "#to_reference" do it 'exposes reference path in context of group' do get api(base_url, user) diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index adfe865da90..245a8aa4905 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -781,7 +781,7 @@ describe API::MergeRequests do it_behaves_like 'merge requests list' end - context "#to_reference" do + describe "#to_reference" do it 'exposes reference path in context of group' do get api("/groups/#{group.id}/merge_requests", user) diff --git a/spec/requests/api/protected_branches_spec.rb b/spec/requests/api/protected_branches_spec.rb index 67ce704b3f3..8499a165d8b 100644 --- a/spec/requests/api/protected_branches_spec.rb +++ b/spec/requests/api/protected_branches_spec.rb @@ -12,18 +12,18 @@ describe API::ProtectedBranches do end describe "GET /projects/:id/protected_branches" do + let(:params) { {} } let(:route) { "/projects/#{project.id}/protected_branches" } shared_examples_for 'protected branches' do it 'returns the protected branches' do - get api(route, user), params: { per_page: 100 } + get api(route, user), params: params.merge(per_page: 100) expect(response).to have_gitlab_http_status(200) expect(response).to include_pagination_headers expect(json_response).to be_an Array protected_branch_names = json_response.map { |x| x['name'] } - expected_branch_names = project.protected_branches.map { |x| x['name'] } expect(protected_branch_names).to match_array(expected_branch_names) end end @@ -33,7 +33,19 @@ describe API::ProtectedBranches do project.add_maintainer(user) end - it_behaves_like 'protected branches' + context 'when search param is not present' do + it_behaves_like 'protected branches' do + let(:expected_branch_names) { project.protected_branches.map { |x| x['name'] } } + end + end + + context 'when search param is present' do + it_behaves_like 'protected branches' do + let(:another_protected_branch) { create(:protected_branch, project: project, name: 'stable') } + let(:params) { { search: another_protected_branch.name } } + let(:expected_branch_names) { [another_protected_branch.name] } + end + end end context 'when authenticated as a guest' do diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 84e1f95828a..f6ff2020c79 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -778,6 +778,12 @@ describe API::Users do expect(user.reload.external?).to be_truthy end + it "private profile is false by default" do + put api("/users/#{user.id}", admin), params: {} + + expect(user.reload.private_profile).to eq(false) + end + it "updates private profile" do put api("/users/#{user.id}", admin), params: { private_profile: true } @@ -785,14 +791,24 @@ describe API::Users do expect(user.reload.private_profile).to eq(true) end - it "updates private profile when nil is given to false" do - admin.update(private_profile: true) + it "updates private profile to false when nil is given" do + user.update(private_profile: true) put api("/users/#{user.id}", admin), params: { private_profile: nil } + expect(response).to have_gitlab_http_status(200) expect(user.reload.private_profile).to eq(false) end + it "does not modify private profile when field is not provided" do + user.update(private_profile: true) + + put api("/users/#{user.id}", admin), params: {} + + expect(response).to have_gitlab_http_status(200) + expect(user.reload.private_profile).to eq(true) + end + it "does not update admin status" do put api("/users/#{admin_user.id}", admin), params: { can_create_group: false } |