Commit f1b41130 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'deprecated-positional-spec-arguments' into 'master'

Fix deprecation: Using positional arguments in specs for EE specs in spec/

See merge request gitlab-org/gitlab-ee!9040
parents c4b7e592 b9f25a24
---
title: 'Fix deprecation: Using positional arguments in specs for EE spes in spec/'
merge_request: 9040
author: Jasper Maes
type: other
......@@ -45,7 +45,7 @@ describe Groups::EpicLinksController, :postgresql do
epic1.update(parent: parent_epic)
end
subject { get :index, group_id: group, epic_id: parent_epic.to_param }
subject { get :index, params: { group_id: group, epic_id: parent_epic.to_param } }
it_behaves_like 'unlicensed epics action'
it_behaves_like 'feature flag disabled'
......@@ -72,7 +72,7 @@ describe Groups::EpicLinksController, :postgresql do
subject do
reference = [epic1.to_reference(full: true)]
post :create, group_id: group, epic_id: parent_epic.to_param, issuable_references: reference
post :create, params: { group_id: group, epic_id: parent_epic.to_param, issuable_references: reference }
end
it_behaves_like 'unlicensed epics action'
......@@ -121,7 +121,7 @@ describe Groups::EpicLinksController, :postgresql do
epic1.update(parent: parent_epic)
end
subject { delete :destroy, group_id: group, epic_id: parent_epic.to_param, id: epic1.id }
subject { delete :destroy, params: { group_id: group, epic_id: parent_epic.to_param, id: epic1.id } }
it_behaves_like 'unlicensed epics action'
it_behaves_like 'feature flag disabled'
......@@ -162,7 +162,7 @@ describe Groups::EpicLinksController, :postgresql do
context 'when the epic does not have any parent' do
it 'returns status 404' do
delete :destroy, group_id: group, epic_id: parent_epic.to_param, id: epic2.id
delete :destroy, params: { group_id: group, epic_id: parent_epic.to_param, id: epic2.id }
expect(response.status).to eq(403)
end
......
......@@ -231,7 +231,7 @@ describe Groups::Security::VulnerabilitiesController do
context 'with enabled filters' do
it 'returns counts for filtered vulnerabilities' do
get :summary, group_id: group, report_type: %w[sast dast], severity: %[high low], format: :json
get :summary, params: { group_id: group, report_type: %w[sast dast], severity: %[high low] }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(json_response).to be_an(Hash)
......
......@@ -105,7 +105,7 @@ describe Projects::IssuesController do
end
def perform(method, action, opts = {})
send(method, action, opts.merge(namespace_id: project.namespace.to_param, project_id: project.to_param))
send(method, action, params: opts.merge(namespace_id: project.namespace.to_param, project_id: project.to_param))
end
context 'licensed' do
......
......@@ -115,7 +115,7 @@ describe Projects::Prometheus::AlertsController do
expect(notify_service).to receive(:execute).with('some token')
post :notify, project_params, as: :json
post :notify, params: project_params, as: :json
end
it 'pass nil if cannot extract a non-bearer token' do
......@@ -123,7 +123,7 @@ describe Projects::Prometheus::AlertsController do
expect(notify_service).to receive(:execute).with(nil)
post :notify, project_params, as: :json
post :notify, params: project_params, as: :json
end
end
......@@ -131,7 +131,7 @@ describe Projects::Prometheus::AlertsController do
it 'passes nil' do
expect(notify_service) .to receive(:execute).with(nil)
post :notify, project_params, as: :json
post :notify, params: project_params, as: :json
end
end
end
......
......@@ -81,7 +81,7 @@ describe API::NpmPackages do
end
def get_package(package, params = {})
get api("/packages/npm/#{package.name}"), params
get api("/packages/npm/#{package.name}"), params: params
end
def get_package_with_token(package, params = {})
......@@ -139,7 +139,7 @@ describe API::NpmPackages do
def get_file(package_file, params = {})
get api("/projects/#{project.id}/packages/npm/" \
"#{package_file.package.name}/-/#{package_file.file_name}"), params
"#{package_file.package.name}/-/#{package_file.file_name}"), params: params
end
def get_file_with_token(package_file, params = {})
......@@ -176,7 +176,7 @@ describe API::NpmPackages do
end
def upload_package(package_name, params = {})
put api("/projects/#{project.id}/packages/npm/#{package_name.sub('/', '%2f')}"), params
put api("/projects/#{project.id}/packages/npm/#{package_name.sub('/', '%2f')}"), params: params
end
def upload_package_with_token(package_name, params = {})
......
......@@ -56,9 +56,9 @@ describe Groups::GroupMembersController do
it 'creates an audit event' do
expect do
post :create, group_id: group,
user_ids: group_user.id,
access_level: Gitlab::Access::GUEST
post :create, params: { group_id: group,
user_ids: group_user.id,
access_level: Gitlab::Access::GUEST }
end.to change(AuditEvent, :count).by(1)
end
......@@ -184,7 +184,7 @@ describe Groups::GroupMembersController do
end
it 'creates an audit event' do
expect { delete :leave, group_id: group }.to change(AuditEvent, :count).by(1)
expect { delete :leave, params: { group_id: group } }.to change(AuditEvent, :count).by(1)
end
end
......@@ -200,7 +200,7 @@ describe Groups::GroupMembersController do
end
it 'does not create an audit event' do
expect { delete :leave, group_id: group }.not_to change(AuditEvent, :count)
expect { delete :leave, params: { group_id: group } }.not_to change(AuditEvent, :count)
end
end
......@@ -219,7 +219,7 @@ describe Groups::GroupMembersController do
end
it 'creates an audit event' do
expect { delete :leave, group_id: group }.to change(AuditEvent, :count).by(1)
expect { delete :leave, params: { group_id: group } }.to change(AuditEvent, :count).by(1)
end
end
end
......
......@@ -116,7 +116,7 @@ describe GroupsController do
sign_in(user)
expect do
post :create, group: { name: 'new_group', path: "new_group" }
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
expect(response).to have_gitlab_http_status(302)
......@@ -127,7 +127,7 @@ describe GroupsController do
sign_in(create(:admin))
expect do
post :create, group: { name: 'new_group', path: "new_group" }
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
expect(response).to have_gitlab_http_status(302)
......@@ -137,7 +137,7 @@ describe GroupsController do
sign_in(create(:user, :auditor, can_create_group: true))
expect do
post :create, group: { name: 'new_group', path: "new_group" }
post :create, params: { group: { name: 'new_group', path: "new_group" } }
end.to change { Group.count }.by(1)
expect(response).to have_gitlab_http_status(302)
......@@ -352,7 +352,7 @@ describe GroupsController do
end
it 'updates the project_creation_level successfully' do
post :update, id: group.to_param, group: { project_creation_level: ::EE::Gitlab::Access::MAINTAINER_PROJECT_ACCESS }
post :update, params: { id: group.to_param, group: { project_creation_level: ::EE::Gitlab::Access::MAINTAINER_PROJECT_ACCESS } }
expect(response).to have_gitlab_http_status(302)
expect(group.reload.project_creation_level).to eq(::EE::Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
......
......@@ -419,7 +419,7 @@ describe API::Branches do
it "updates 'developers_can_push' without removing the 'no_one' access level" do
put api("/projects/#{project.id}/repository/branches/#{protected_branch.name}/protect", user),
developers_can_push: true, developers_can_merge: true
params: { developers_can_push: true, developers_can_merge: true }
expect(response).to have_gitlab_http_status(200)
expect(json_response['name']).to eq(protected_branch.name)
......
......@@ -456,7 +456,7 @@ describe API::Groups do
# EE
it 'returns 403 for updating shared_runners_minutes_limit' do
expect do
put api("/groups/#{group1.id}", user1), shared_runners_minutes_limit: 133
put api("/groups/#{group1.id}", user1), params: { shared_runners_minutes_limit: 133 }
end.not_to change { group1.shared_runners_minutes_limit }
expect(response).to have_gitlab_http_status(403)
......@@ -466,7 +466,7 @@ describe API::Groups do
group1.update(shared_runners_minutes_limit: 133)
expect do
put api("/groups/#{group1.id}", user1), shared_runners_minutes_limit: 133
put api("/groups/#{group1.id}", user1), params: { shared_runners_minutes_limit: 133 }
end.not_to change { group1.shared_runners_minutes_limit }
expect(response).to have_gitlab_http_status(200)
......@@ -484,7 +484,7 @@ describe API::Groups do
# EE
it 'updates the group for shared_runners_minutes_limit' do
expect do
put api("/groups/#{group1.id}", admin), shared_runners_minutes_limit: 133
put api("/groups/#{group1.id}", admin), params: { shared_runners_minutes_limit: 133 }
end.to change { group1.reload.shared_runners_minutes_limit }
.from(nil).to(133)
......@@ -888,7 +888,7 @@ describe API::Groups do
it "creates an ldap_group_link if ldap_cn and ldap_access are supplied" do
group_attributes = attributes_for(:group, ldap_cn: 'ldap-group', ldap_access: Gitlab::Access::DEVELOPER)
expect { post api("/groups", admin), group_attributes }.to change { LdapGroupLink.count }.by(1)
expect { post api("/groups", admin), params: group_attributes }.to change { LdapGroupLink.count }.by(1)
end
# EE
......@@ -898,7 +898,7 @@ describe API::Groups do
group = attributes_for(:group, { shared_runners_minutes_limit: 133 })
expect do
post api("/groups", user3), group
post api("/groups", user3), params: group
end.not_to change { Group.count }
expect(response).to have_gitlab_http_status(403)
......@@ -910,7 +910,7 @@ describe API::Groups do
group = attributes_for(:group, { shared_runners_minutes_limit: 133 })
expect do
post api("/groups", admin), group
post api("/groups", admin), params: group
end.to change { Group.count }.by(1)
created_group = Group.find(json_response['id'])
......
......@@ -611,7 +611,7 @@ describe API::Jobs do
pipeline.update(ref: 'master',
sha: project.commit('master').sha)
get api("/projects/#{project.id}/jobs/artifacts/master/download"), job: job.name, job_token: job.token
get api("/projects/#{project.id}/jobs/artifacts/master/download"), params: { job: job.name, job_token: job.token }
end
context 'when user is reporter' do
......
......@@ -302,7 +302,7 @@ describe API::Members do
project.group.add_owner(maintainer)
post api("/projects/#{project.id}/members", maintainer),
user_id: developer.id, access_level: Member::MAINTAINER
params: { user_id: developer.id, access_level: Member::MAINTAINER }
expect(response.status).to eq 405
end
......
......@@ -1632,7 +1632,7 @@ describe API::Projects do
it 'updates approvals_before_merge' do
project_param = { approvals_before_merge: 3 }
put api("/projects/#{project.id}", user), project_param
put api("/projects/#{project.id}", user), params: project_param
expect(response).to have_gitlab_http_status(200)
expect(json_response['approvals_before_merge']).to eq(3)
......
......@@ -195,7 +195,7 @@ describe API::ProtectedBranches do
end
it 'protects a single branch and only admins can unprotect' do
post post_endpoint, name: branch_name, unprotect_access_level: Gitlab::Access::ADMIN
post post_endpoint, params: { name: branch_name, unprotect_access_level: Gitlab::Access::ADMIN }
expect(response).to have_gitlab_http_status(201)
expect(json_response['name']).to eq(branch_name)
......@@ -225,7 +225,7 @@ describe API::ProtectedBranches do
it 'can protect a branch while allowing an individual user to push' do
push_user = project_member
post post_endpoint, name: branch_name, allowed_to_push: [{ user_id: push_user.id }]
post post_endpoint, params: { name: branch_name, allowed_to_push: [{ user_id: push_user.id }] }
expect_protection_to_be_successful
expect(json_response['push_access_levels'][0]['user_id']).to eq(push_user.id)
......@@ -234,7 +234,7 @@ describe API::ProtectedBranches do
it 'can protect a branch while allowing an individual user to merge' do
merge_user = project_member
post post_endpoint, name: branch_name, allowed_to_merge: [{ user_id: merge_user.id }]
post post_endpoint, params: { name: branch_name, allowed_to_merge: [{ user_id: merge_user.id }] }
expect_protection_to_be_successful
expect(json_response['merge_access_levels'][0]['user_id']).to eq(merge_user.id)
......@@ -243,7 +243,7 @@ describe API::ProtectedBranches do
it 'can protect a branch while allowing an individual user to unprotect' do
unprotect_user = project_member
post post_endpoint, name: branch_name, allowed_to_unprotect: [{ user_id: unprotect_user.id }]
post post_endpoint, params: { name: branch_name, allowed_to_unprotect: [{ user_id: unprotect_user.id }] }
expect_protection_to_be_successful
expect(json_response['unprotect_access_levels'][0]['user_id']).to eq(unprotect_user.id)
......@@ -252,7 +252,7 @@ describe API::ProtectedBranches do
it 'can protect a branch while allowing a group to push' do
push_group = invited_group
post post_endpoint, name: branch_name, allowed_to_push: [{ group_id: push_group.id }]
post post_endpoint, params: { name: branch_name, allowed_to_push: [{ group_id: push_group.id }] }
expect_protection_to_be_successful
expect(json_response['push_access_levels'][0]['group_id']).to eq(push_group.id)
......@@ -261,7 +261,7 @@ describe API::ProtectedBranches do
it 'can protect a branch while allowing a group to merge' do
merge_group = invited_group
post post_endpoint, name: branch_name, allowed_to_merge: [{ group_id: merge_group.id }]
post post_endpoint, params: { name: branch_name, allowed_to_merge: [{ group_id: merge_group.id }] }
expect_protection_to_be_successful
expect(json_response['merge_access_levels'][0]['group_id']).to eq(merge_group.id)
......@@ -270,7 +270,7 @@ describe API::ProtectedBranches do
it 'can protect a branch while allowing a group to unprotect' do
unprotect_group = invited_group
post post_endpoint, name: branch_name, allowed_to_unprotect: [{ group_id: unprotect_group.id }]
post post_endpoint, params: { name: branch_name, allowed_to_unprotect: [{ group_id: unprotect_group.id }] }
expect_protection_to_be_successful
expect(json_response['unprotect_access_levels'][0]['group_id']).to eq(unprotect_group.id)
......@@ -279,7 +279,7 @@ describe API::ProtectedBranches do
it "fails if users don't all have access to the project" do
push_user = create(:user)
post post_endpoint, name: branch_name, allowed_to_merge: [{ user_id: push_user.id }]
post post_endpoint, params: { name: branch_name, allowed_to_merge: [{ user_id: push_user.id }] }
expect(response).to have_gitlab_http_status(422)
expect(json_response['message'][0]).to match(/Cannot add users or groups/)
......@@ -288,7 +288,7 @@ describe API::ProtectedBranches do
it "fails if groups aren't all invited to the project" do
merge_group = create(:group)
post post_endpoint, name: branch_name, allowed_to_merge: [{ group_id: merge_group.id }]
post post_endpoint, params: { name: branch_name, allowed_to_merge: [{ group_id: merge_group.id }] }
expect(response).to have_gitlab_http_status(422)
expect(json_response['message'][0]).to match(/Cannot add users or groups/)
......@@ -297,7 +297,7 @@ describe API::ProtectedBranches do
it 'avoids creating default access levels unless necessary' do
push_user = project_member
post post_endpoint, name: branch_name, allowed_to_push: [{ user_id: push_user.id }]
post post_endpoint, params: { name: branch_name, allowed_to_push: [{ user_id: push_user.id }] }
expect(response).to have_gitlab_http_status(201)
expect(json_response['push_access_levels'].count).to eq(1)
......
......@@ -209,7 +209,7 @@ describe API::Services do
end
it 'returns status 200' do
post api('/slack/trigger'), token: 'token', text: 'help'
post api('/slack/trigger'), params: { token: 'token', text: 'help' }
expect(response).to have_gitlab_http_status(200)
expect(json_response['response_type']).to eq("ephemeral")
......
......@@ -135,7 +135,7 @@ describe API::Triggers do
let(:params) { { ref: 'refs/heads/other-branch' } }
subject do
post api("/projects/#{project.id}/ref/master/trigger/pipeline?token=#{other_job.token}"), params
post api("/projects/#{project.id}/ref/master/trigger/pipeline?token=#{other_job.token}"), params: params
end
context 'without user' do
......
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