summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2018-12-18 09:52:17 +1100
committerblackst0ne <blackst0ne.ru@gmail.com>2018-12-19 10:04:31 +1100
commitb44a2c801a64fb282cea794871fcfcf81e4ec539 (patch)
tree32e699b6efa548048abe11f29f84e85e3d2a034f /spec/controllers
parent5d68c23792e87e710877e4baf57605bcf11a6cb5 (diff)
downloadgitlab-ce-b44a2c801a64fb282cea794871fcfcf81e4ec539.tar.gz
Update specs to rails5 formatblackst0ne-convert-specs-rails5-style
Updates specs to use new rails5 format. The old format: `get :show, { some: params }, { some: headers }` The new format: `get :show, params: { some: params }, headers: { some: headers }`
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/abuse_reports_controller_spec.rb12
-rw-r--r--spec/controllers/admin/application_settings_controller_spec.rb10
-rw-r--r--spec/controllers/admin/applications_controller_spec.rb10
-rw-r--r--spec/controllers/admin/groups_controller_spec.rb28
-rw-r--r--spec/controllers/admin/hooks_controller_spec.rb2
-rw-r--r--spec/controllers/admin/identities_controller_spec.rb4
-rw-r--r--spec/controllers/admin/projects_controller_spec.rb6
-rw-r--r--spec/controllers/admin/runners_controller_spec.rb12
-rw-r--r--spec/controllers/admin/services_controller_spec.rb6
-rw-r--r--spec/controllers/admin/spam_logs_controller_spec.rb6
-rw-r--r--spec/controllers/admin/users_controller_spec.rb36
-rw-r--r--spec/controllers/application_controller_spec.rb8
-rw-r--r--spec/controllers/autocomplete_controller_spec.rb40
-rw-r--r--spec/controllers/boards/issues_controller_spec.rb24
-rw-r--r--spec/controllers/boards/lists_controller_spec.rb36
-rw-r--r--spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb6
-rw-r--r--spec/controllers/concerns/group_tree_spec.rb12
-rw-r--r--spec/controllers/concerns/lfs_request_spec.rb4
-rw-r--r--spec/controllers/dashboard/groups_controller_spec.rb2
-rw-r--r--spec/controllers/dashboard/milestones_controller_spec.rb2
-rw-r--r--spec/controllers/dashboard/todos_controller_spec.rb24
-rw-r--r--spec/controllers/explore/projects_controller_spec.rb4
-rw-r--r--spec/controllers/google_api/authorizations_controller_spec.rb2
-rw-r--r--spec/controllers/graphql_controller_spec.rb2
-rw-r--r--spec/controllers/groups/avatars_controller_spec.rb2
-rw-r--r--spec/controllers/groups/boards_controller_spec.rb8
-rw-r--r--spec/controllers/groups/children_controller_spec.rb42
-rw-r--r--spec/controllers/groups/clusters/applications_controller_spec.rb2
-rw-r--r--spec/controllers/groups/clusters_controller_spec.rb28
-rw-r--r--spec/controllers/groups/group_members_controller_spec.rb50
-rw-r--r--spec/controllers/groups/labels_controller_spec.rb6
-rw-r--r--spec/controllers/groups/milestones_controller_spec.rb68
-rw-r--r--spec/controllers/groups/runners_controller_spec.rb8
-rw-r--r--spec/controllers/groups/settings/ci_cd_controller_spec.rb4
-rw-r--r--spec/controllers/groups/shared_projects_controller_spec.rb2
-rw-r--r--spec/controllers/groups/uploads_controller_spec.rb2
-rw-r--r--spec/controllers/groups/variables_controller_spec.rb8
-rw-r--r--spec/controllers/groups_controller_spec.rb96
-rw-r--r--spec/controllers/health_check_controller_spec.rb6
-rw-r--r--spec/controllers/health_controller_spec.rb4
-rw-r--r--spec/controllers/help_controller_spec.rb16
-rw-r--r--spec/controllers/import/bitbucket_controller_spec.rb14
-rw-r--r--spec/controllers/import/bitbucket_server_controller_spec.rb14
-rw-r--r--spec/controllers/import/gitlab_controller_spec.rb14
-rw-r--r--spec/controllers/import/gitlab_projects_controller_spec.rb6
-rw-r--r--spec/controllers/import/google_code_controller_spec.rb2
-rw-r--r--spec/controllers/invites_controller_spec.rb4
-rw-r--r--spec/controllers/ldap/omniauth_callbacks_controller_spec.rb4
-rw-r--r--spec/controllers/notification_settings_controller_spec.rb60
-rw-r--r--spec/controllers/oauth/applications_controller_spec.rb6
-rw-r--r--spec/controllers/oauth/authorizations_controller_spec.rb6
-rw-r--r--spec/controllers/passwords_controller_spec.rb2
-rw-r--r--spec/controllers/profiles/accounts_controller_spec.rb6
-rw-r--r--spec/controllers/profiles/emails_controller_spec.rb6
-rw-r--r--spec/controllers/profiles/keys_controller_spec.rb16
-rw-r--r--spec/controllers/profiles/notifications_controller_spec.rb4
-rw-r--r--spec/controllers/profiles/personal_access_tokens_controller_spec.rb4
-rw-r--r--spec/controllers/profiles/preferences_controller_spec.rb2
-rw-r--r--spec/controllers/profiles/two_factor_auths_controller_spec.rb2
-rw-r--r--spec/controllers/profiles_controller_spec.rb28
-rw-r--r--spec/controllers/projects/artifacts_controller_spec.rb30
-rw-r--r--spec/controllers/projects/avatars_controller_spec.rb4
-rw-r--r--spec/controllers/projects/badges_controller_spec.rb2
-rw-r--r--spec/controllers/projects/blame_controller_spec.rb8
-rw-r--r--spec/controllers/projects/blob_controller_spec.rb62
-rw-r--r--spec/controllers/projects/boards_controller_spec.rb14
-rw-r--r--spec/controllers/projects/branches_controller_spec.rb175
-rw-r--r--spec/controllers/projects/ci/lints_controller_spec.rb10
-rw-r--r--spec/controllers/projects/clusters/applications_controller_spec.rb2
-rw-r--r--spec/controllers/projects/clusters_controller_spec.rb42
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb106
-rw-r--r--spec/controllers/projects/commits_controller_spec.rb38
-rw-r--r--spec/controllers/projects/compare_controller_spec.rb10
-rw-r--r--spec/controllers/projects/cycle_analytics_controller_spec.rb12
-rw-r--r--spec/controllers/projects/deploy_keys_controller_spec.rb24
-rw-r--r--spec/controllers/projects/deployments_controller_spec.rb18
-rw-r--r--spec/controllers/projects/discussions_controller_spec.rb34
-rw-r--r--spec/controllers/projects/environments_controller_spec.rb64
-rw-r--r--spec/controllers/projects/find_file_controller_spec.rb16
-rw-r--r--spec/controllers/projects/forks_controller_spec.rb20
-rw-r--r--spec/controllers/projects/graphs_controller_spec.rb4
-rw-r--r--spec/controllers/projects/group_links_controller_spec.rb28
-rw-r--r--spec/controllers/projects/hooks_controller_spec.rb4
-rw-r--r--spec/controllers/projects/imports_controller_spec.rb20
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb181
-rw-r--r--spec/controllers/projects/jobs_controller_spec.rb76
-rw-r--r--spec/controllers/projects/labels_controller_spec.rb30
-rw-r--r--spec/controllers/projects/mattermosts_controller_spec.rb14
-rw-r--r--spec/controllers/projects/merge_requests/conflicts_controller_spec.rb42
-rw-r--r--spec/controllers/projects/merge_requests/creations_controller_spec.rb32
-rw-r--r--spec/controllers/projects/merge_requests/diffs_controller_spec.rb4
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb123
-rw-r--r--spec/controllers/projects/milestones_controller_spec.rb24
-rw-r--r--spec/controllers/projects/mirrors_controller_spec.rb4
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb88
-rw-r--r--spec/controllers/projects/pages_controller_spec.rb16
-rw-r--r--spec/controllers/projects/pages_domains_controller_spec.rb32
-rw-r--r--spec/controllers/projects/pipeline_schedules_controller_spec.rb24
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb56
-rw-r--r--spec/controllers/projects/pipelines_settings_controller_spec.rb2
-rw-r--r--spec/controllers/projects/project_members_controller_spec.rb138
-rw-r--r--spec/controllers/projects/prometheus/metrics_controller_spec.rb10
-rw-r--r--spec/controllers/projects/protected_branches_controller_spec.rb14
-rw-r--r--spec/controllers/projects/protected_tags_controller_spec.rb4
-rw-r--r--spec/controllers/projects/raw_controller_spec.rb8
-rw-r--r--spec/controllers/projects/refs_controller_spec.rb10
-rw-r--r--spec/controllers/projects/registry/repositories_controller_spec.rb14
-rw-r--r--spec/controllers/projects/registry/tags_controller_spec.rb18
-rw-r--r--spec/controllers/projects/releases_controller_spec.rb2
-rw-r--r--spec/controllers/projects/repositories_controller_spec.rb16
-rw-r--r--spec/controllers/projects/runners_controller_spec.rb8
-rw-r--r--spec/controllers/projects/serverless/functions_controller_spec.rb8
-rw-r--r--spec/controllers/projects/services_controller_spec.rb30
-rw-r--r--spec/controllers/projects/settings/ci_cd_controller_spec.rb16
-rw-r--r--spec/controllers/projects/settings/integrations_controller_spec.rb2
-rw-r--r--spec/controllers/projects/settings/repository_controller_spec.rb4
-rw-r--r--spec/controllers/projects/snippets_controller_spec.rb46
-rw-r--r--spec/controllers/projects/tags_controller_spec.rb4
-rw-r--r--spec/controllers/projects/templates_controller_spec.rb8
-rw-r--r--spec/controllers/projects/todos_controller_spec.rb20
-rw-r--r--spec/controllers/projects/tree_controller_spec.rb30
-rw-r--r--spec/controllers/projects/uploads_controller_spec.rb4
-rw-r--r--spec/controllers/projects/variables_controller_spec.rb10
-rw-r--r--spec/controllers/projects/wikis_controller_spec.rb18
-rw-r--r--spec/controllers/projects_controller_spec.rb199
-rw-r--r--spec/controllers/registrations_controller_spec.rb22
-rw-r--r--spec/controllers/search_controller_spec.rb12
-rw-r--r--spec/controllers/sent_notifications_controller_spec.rb10
-rw-r--r--spec/controllers/sessions_controller_spec.rb24
-rw-r--r--spec/controllers/snippets/notes_controller_spec.rb28
-rw-r--r--spec/controllers/snippets_controller_spec.rb56
-rw-r--r--spec/controllers/uploads_controller_spec.rb96
-rw-r--r--spec/controllers/user_callouts_controller_spec.rb2
-rw-r--r--spec/controllers/users/terms_controller_spec.rb14
-rw-r--r--spec/controllers/users_controller_spec.rb62
135 files changed, 1859 insertions, 1453 deletions
diff --git a/spec/controllers/abuse_reports_controller_spec.rb b/spec/controllers/abuse_reports_controller_spec.rb
index ada011e7595..7104305e9d2 100644
--- a/spec/controllers/abuse_reports_controller_spec.rb
+++ b/spec/controllers/abuse_reports_controller_spec.rb
@@ -19,7 +19,7 @@ describe AbuseReportsController do
user_id = user.id
user.destroy
- get :new, { user_id: user_id }
+ get :new, params: { user_id: user_id }
expect(response).to redirect_to root_path
expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.')
@@ -30,7 +30,7 @@ describe AbuseReportsController do
it 'redirects the reporter to the user\'s profile' do
user.block
- get :new, { user_id: user.id }
+ get :new, params: { user_id: user.id }
expect(response).to redirect_to user
expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.')
@@ -42,18 +42,18 @@ describe AbuseReportsController do
context 'with valid attributes' do
it 'saves the abuse report' do
expect do
- post :create, abuse_report: attrs
+ post :create, params: { abuse_report: attrs }
end.to change { AbuseReport.count }.by(1)
end
it 'calls notify' do
expect_any_instance_of(AbuseReport).to receive(:notify)
- post :create, abuse_report: attrs
+ post :create, params: { abuse_report: attrs }
end
it 'redirects back to the reported user' do
- post :create, abuse_report: attrs
+ post :create, params: { abuse_report: attrs }
expect(response).to redirect_to user
end
@@ -62,7 +62,7 @@ describe AbuseReportsController do
context 'with invalid attributes' do
it 'renders new' do
attrs.delete(:user_id)
- post :create, abuse_report: attrs
+ post :create, params: { abuse_report: attrs }
expect(response).to render_template(:new)
end
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb
index 2e0f79cd313..9af472df74e 100644
--- a/spec/controllers/admin/application_settings_controller_spec.rb
+++ b/spec/controllers/admin/application_settings_controller_spec.rb
@@ -52,35 +52,35 @@ describe Admin::ApplicationSettingsController do
end
it 'updates the password_authentication_enabled_for_git setting' do
- put :update, application_setting: { password_authentication_enabled_for_git: "0" }
+ put :update, params: { application_setting: { password_authentication_enabled_for_git: "0" } }
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.password_authentication_enabled_for_git).to eq(false)
end
it 'updates the default_project_visibility for string value' do
- put :update, application_setting: { default_project_visibility: "20" }
+ put :update, params: { application_setting: { default_project_visibility: "20" } }
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.default_project_visibility).to eq(Gitlab::VisibilityLevel::PUBLIC)
end
it 'update the restricted levels for string values' do
- put :update, application_setting: { restricted_visibility_levels: %w[10 20] }
+ put :update, params: { application_setting: { restricted_visibility_levels: %w[10 20] } }
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.restricted_visibility_levels).to eq([10, 20])
end
it 'updates the restricted_visibility_levels when empty array is passed' do
- put :update, application_setting: { restricted_visibility_levels: [""] }
+ put :update, params: { application_setting: { restricted_visibility_levels: [""] } }
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty
end
it 'updates the receive_max_input_size setting' do
- put :update, application_setting: { receive_max_input_size: "1024" }
+ put :update, params: { application_setting: { receive_max_input_size: "1024" } }
expect(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.receive_max_input_size).to eq(1024)
diff --git a/spec/controllers/admin/applications_controller_spec.rb b/spec/controllers/admin/applications_controller_spec.rb
index 7bd6c0e6117..7e1ce70dc7d 100644
--- a/spec/controllers/admin/applications_controller_spec.rb
+++ b/spec/controllers/admin/applications_controller_spec.rb
@@ -19,7 +19,7 @@ describe Admin::ApplicationsController do
describe 'GET #edit' do
it 'renders the application form' do
- get :edit, id: application.id
+ get :edit, params: { id: application.id }
expect(response).to render_template :edit
expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes)
@@ -31,7 +31,7 @@ describe Admin::ApplicationsController do
create_params = attributes_for(:application, trusted: true)
expect do
- post :create, doorkeeper_application: create_params
+ post :create, params: { doorkeeper_application: create_params }
end.to change { Doorkeeper::Application.count }.by(1)
application = Doorkeeper::Application.last
@@ -42,7 +42,7 @@ describe Admin::ApplicationsController do
it 'renders the application form on errors' do
expect do
- post :create, doorkeeper_application: attributes_for(:application).merge(redirect_uri: nil)
+ post :create, params: { doorkeeper_application: attributes_for(:application).merge(redirect_uri: nil) }
end.not_to change { Doorkeeper::Application.count }
expect(response).to render_template :new
@@ -52,7 +52,7 @@ describe Admin::ApplicationsController do
describe 'PATCH #update' do
it 'updates the application' do
- patch :update, id: application.id, doorkeeper_application: { redirect_uri: 'http://example.com/', trusted: true }
+ patch :update, params: { id: application.id, doorkeeper_application: { redirect_uri: 'http://example.com/', trusted: true } }
application.reload
@@ -61,7 +61,7 @@ describe Admin::ApplicationsController do
end
it 'renders the application form on errors' do
- patch :update, id: application.id, doorkeeper_application: { redirect_uri: nil }
+ patch :update, params: { id: application.id, doorkeeper_application: { redirect_uri: nil } }
expect(response).to render_template :edit
expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes)
diff --git a/spec/controllers/admin/groups_controller_spec.rb b/spec/controllers/admin/groups_controller_spec.rb
index 0dad95e418f..647fce0ecef 100644
--- a/spec/controllers/admin/groups_controller_spec.rb
+++ b/spec/controllers/admin/groups_controller_spec.rb
@@ -12,12 +12,12 @@ describe Admin::GroupsController do
describe 'DELETE #destroy' do
it 'schedules a group destroy' do
Sidekiq::Testing.fake! do
- expect { delete :destroy, id: project.group.path }.to change(GroupDestroyWorker.jobs, :size).by(1)
+ expect { delete :destroy, params: { id: project.group.path } }.to change(GroupDestroyWorker.jobs, :size).by(1)
end
end
it 'redirects to the admin group path' do
- delete :destroy, id: project.group.path
+ delete :destroy, params: { id: project.group.path }
expect(response).to redirect_to(admin_groups_path)
end
@@ -27,9 +27,11 @@ describe Admin::GroupsController do
let(:group_user) { create(:user) }
it 'adds user to members' do
- put :members_update, id: group,
- user_ids: group_user.id,
- access_level: Gitlab::Access::GUEST
+ put :members_update, params: {
+ id: group,
+ user_ids: group_user.id,
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(admin_group_path(group))
@@ -37,18 +39,22 @@ describe Admin::GroupsController do
end
it 'can add unlimited members' do
- put :members_update, id: group,
- user_ids: 1.upto(1000).to_a.join(','),
- access_level: Gitlab::Access::GUEST
+ put :members_update, params: {
+ id: group,
+ user_ids: 1.upto(1000).to_a.join(','),
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(admin_group_path(group))
end
it 'adds no user to members' do
- put :members_update, id: group,
- user_ids: '',
- access_level: Gitlab::Access::GUEST
+ put :members_update, params: {
+ id: group,
+ user_ids: '',
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to set_flash.to 'No users specified.'
expect(response).to redirect_to(admin_group_path(group))
diff --git a/spec/controllers/admin/hooks_controller_spec.rb b/spec/controllers/admin/hooks_controller_spec.rb
index d2c1e634930..9bc58344e4e 100644
--- a/spec/controllers/admin/hooks_controller_spec.rb
+++ b/spec/controllers/admin/hooks_controller_spec.rb
@@ -20,7 +20,7 @@ describe Admin::HooksController do
merge_requests_events: true
}
- post :create, hook: hook_params
+ post :create, params: { hook: hook_params }
expect(response).to have_gitlab_http_status(302)
expect(SystemHook.all.size).to eq(1)
diff --git a/spec/controllers/admin/identities_controller_spec.rb b/spec/controllers/admin/identities_controller_spec.rb
index a29853bf8df..e5428c8ddeb 100644
--- a/spec/controllers/admin/identities_controller_spec.rb
+++ b/spec/controllers/admin/identities_controller_spec.rb
@@ -13,7 +13,7 @@ describe Admin::IdentitiesController do
it 'repairs ldap blocks' do
expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute)
- put :update, user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' }
+ put :update, params: { user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' } }
end
end
@@ -23,7 +23,7 @@ describe Admin::IdentitiesController do
it 'repairs ldap blocks' do
expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute)
- delete :destroy, user_id: user.username, id: user.ldap_identity.id
+ delete :destroy, params: { user_id: user.username, id: user.ldap_identity.id }
end
end
end
diff --git a/spec/controllers/admin/projects_controller_spec.rb b/spec/controllers/admin/projects_controller_spec.rb
index ee1aff09bdf..8166657f674 100644
--- a/spec/controllers/admin/projects_controller_spec.rb
+++ b/spec/controllers/admin/projects_controller_spec.rb
@@ -11,13 +11,13 @@ describe Admin::ProjectsController do
render_views
it 'retrieves the project for the given visibility level' do
- get :index, visibility_level: [Gitlab::VisibilityLevel::PUBLIC]
+ get :index, params: { visibility_level: [Gitlab::VisibilityLevel::PUBLIC] }
expect(response.body).to match(project.name)
end
it 'does not retrieve the project' do
- get :index, visibility_level: [Gitlab::VisibilityLevel::INTERNAL]
+ get :index, params: { visibility_level: [Gitlab::VisibilityLevel::INTERNAL] }
expect(response.body).not_to match(project.name)
end
@@ -47,7 +47,7 @@ describe Admin::ProjectsController do
render_views
it 'renders show page' do
- get :show, namespace_id: project.namespace.path, id: project.path
+ get :show, params: { namespace_id: project.namespace.path, id: project.path }
expect(response).to have_gitlab_http_status(200)
expect(response.body).to match(project.name)
diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb
index 312dbdd0624..4cf14030ca1 100644
--- a/spec/controllers/admin/runners_controller_spec.rb
+++ b/spec/controllers/admin/runners_controller_spec.rb
@@ -17,13 +17,13 @@ describe Admin::RunnersController do
describe '#show' do
it 'shows a particular runner' do
- get :show, id: runner.id
+ get :show, params: { id: runner.id }
expect(response).to have_gitlab_http_status(200)
end
it 'shows 404 for unknown runner' do
- get :show, id: 0
+ get :show, params: { id: 0 }
expect(response).to have_gitlab_http_status(404)
end
@@ -34,7 +34,7 @@ describe Admin::RunnersController do
new_desc = runner.description.swapcase
expect do
- post :update, id: runner.id, runner: { description: new_desc }
+ post :update, params: { id: runner.id, runner: { description: new_desc } }
end.to change { runner.ensure_runner_queue_value }
runner.reload
@@ -46,7 +46,7 @@ describe Admin::RunnersController do
describe '#destroy' do
it 'destroys the runner' do
- delete :destroy, id: runner.id
+ delete :destroy, params: { id: runner.id }
expect(response).to have_gitlab_http_status(302)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
@@ -58,7 +58,7 @@ describe Admin::RunnersController do
runner.update(active: false)
expect do
- post :resume, id: runner.id
+ post :resume, params: { id: runner.id }
end.to change { runner.ensure_runner_queue_value }
runner.reload
@@ -73,7 +73,7 @@ describe Admin::RunnersController do
runner.update(active: true)
expect do
- post :pause, id: runner.id
+ post :pause, params: { id: runner.id }
end.to change { runner.ensure_runner_queue_value }
runner.reload
diff --git a/spec/controllers/admin/services_controller_spec.rb b/spec/controllers/admin/services_controller_spec.rb
index 4439ea4a533..ec161b92245 100644
--- a/spec/controllers/admin/services_controller_spec.rb
+++ b/spec/controllers/admin/services_controller_spec.rb
@@ -18,7 +18,7 @@ describe Admin::ServicesController do
end
it 'successfully displays the template' do
- get :edit, id: service.id
+ get :edit, params: { id: service.id }
expect(response).to have_gitlab_http_status(200)
end
@@ -44,7 +44,7 @@ describe Admin::ServicesController do
it 'calls the propagation worker when service is active' do
expect(PropagateServiceTemplateWorker).to receive(:perform_async).with(service.id)
- put :update, id: service.id, service: { active: true }
+ put :update, params: { id: service.id, service: { active: true } }
expect(response).to have_gitlab_http_status(302)
end
@@ -52,7 +52,7 @@ describe Admin::ServicesController do
it 'does not call the propagation worker when service is not active' do
expect(PropagateServiceTemplateWorker).not_to receive(:perform_async)
- put :update, id: service.id, service: { properties: {} }
+ put :update, params: { id: service.id, service: { properties: {} } }
expect(response).to have_gitlab_http_status(302)
end
diff --git a/spec/controllers/admin/spam_logs_controller_spec.rb b/spec/controllers/admin/spam_logs_controller_spec.rb
index 7a96ef6a5cc..2b946ec1c68 100644
--- a/spec/controllers/admin/spam_logs_controller_spec.rb
+++ b/spec/controllers/admin/spam_logs_controller_spec.rb
@@ -20,13 +20,13 @@ describe Admin::SpamLogsController do
describe '#destroy' do
it 'removes only the spam log when removing log' do
- expect { delete :destroy, id: first_spam.id }.to change { SpamLog.count }.by(-1)
+ expect { delete :destroy, params: { id: first_spam.id } }.to change { SpamLog.count }.by(-1)
expect(User.find(user.id)).to be_truthy
expect(response).to have_gitlab_http_status(200)
end
it 'removes user and his spam logs when removing the user' do
- delete :destroy, id: first_spam.id, remove_user: true
+ delete :destroy, params: { id: first_spam.id, remove_user: true }
expect(flash[:notice]).to eq "User #{user.username} was successfully removed."
expect(response).to have_gitlab_http_status(302)
@@ -40,7 +40,7 @@ describe Admin::SpamLogsController do
allow_any_instance_of(AkismetService).to receive(:submit_ham).and_return(true)
end
it 'submits the log as ham' do
- post :mark_as_ham, id: first_spam.id
+ post :mark_as_ham, params: { id: first_spam.id }
expect(response).to have_gitlab_http_status(302)
expect(SpamLog.find(first_spam.id).submitted_as_ham).to be_truthy
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb
index 3dd0b2623ac..6b66cbd2651 100644
--- a/spec/controllers/admin/users_controller_spec.rb
+++ b/spec/controllers/admin/users_controller_spec.rb
@@ -17,7 +17,7 @@ describe Admin::UsersController do
end
it 'deletes user and ghosts their contributions' do
- delete :destroy, id: user.username, format: :json
+ delete :destroy, params: { id: user.username }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(User.exists?(user.id)).to be_falsy
@@ -25,7 +25,7 @@ describe Admin::UsersController do
end
it 'deletes the user and their contributions when hard delete is specified' do
- delete :destroy, id: user.username, hard_delete: true, format: :json
+ delete :destroy, params: { id: user.username, hard_delete: true }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(User.exists?(user.id)).to be_falsy
@@ -35,7 +35,7 @@ describe Admin::UsersController do
describe 'PUT block/:id' do
it 'blocks user' do
- put :block, id: user.username
+ put :block, params: { id: user.username }
user.reload
expect(user.blocked?).to be_truthy
expect(flash[:notice]).to eq 'Successfully blocked'
@@ -51,7 +51,7 @@ describe Admin::UsersController do
end
it 'does not unblock user' do
- put :unblock, id: user.username
+ put :unblock, params: { id: user.username }
user.reload
expect(user.blocked?).to be_truthy
expect(flash[:alert]).to eq 'This user cannot be unlocked manually from GitLab'
@@ -64,7 +64,7 @@ describe Admin::UsersController do
end
it 'unblocks user' do
- put :unblock, id: user.username
+ put :unblock, params: { id: user.username }
user.reload
expect(user.blocked?).to be_falsey
expect(flash[:notice]).to eq 'Successfully unblocked'
@@ -79,7 +79,7 @@ describe Admin::UsersController do
end
it 'unlocks user' do
- put :unlock, id: user.username
+ put :unlock, params: { id: user.username }
user.reload
expect(user.access_locked?).to be_falsey
end
@@ -93,7 +93,7 @@ describe Admin::UsersController do
end
it 'confirms user' do
- put :confirm, id: user.username
+ put :confirm, params: { id: user.username }
user.reload
expect(user.confirmed?).to be_truthy
end
@@ -121,17 +121,17 @@ describe Admin::UsersController do
end
def go
- patch :disable_two_factor, id: user.to_param
+ patch :disable_two_factor, params: { id: user.to_param }
end
end
describe 'POST create' do
it 'creates the user' do
- expect { post :create, user: attributes_for(:user) }.to change { User.count }.by(1)
+ expect { post :create, params: { user: attributes_for(:user) } }.to change { User.count }.by(1)
end
it 'shows only one error message for an invalid email' do
- post :create, user: attributes_for(:user, email: 'bogus')
+ post :create, params: { user: attributes_for(:user, email: 'bogus') }
expect(assigns[:user].errors).to contain_exactly("Email is invalid")
end
end
@@ -147,7 +147,7 @@ describe Admin::UsersController do
}
}
- post :update, params
+ post :update, params: params
end
context 'when the admin changes his own password' do
@@ -227,13 +227,13 @@ describe Admin::UsersController do
end
it "shows a notice" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(flash[:alert]).to eq("You cannot impersonate a blocked user")
end
it "doesn't sign us in as the user" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(warden.user).to eq(admin)
end
@@ -241,25 +241,25 @@ describe Admin::UsersController do
context "when the user is not blocked" do
it "stores the impersonator in the session" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(session[:impersonator_id]).to eq(admin.id)
end
it "signs us in as the user" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(warden.user).to eq(user)
end
it "redirects to root" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(response).to redirect_to(root_path)
end
it "shows a notice" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(flash[:alert]).to eq("You are now impersonating #{user.username}")
end
@@ -271,7 +271,7 @@ describe Admin::UsersController do
end
it "shows error page" do
- post :impersonate, id: user.username
+ post :impersonate, params: { id: user.username }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 945c9f97fc3..43f561f7a25 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -522,13 +522,13 @@ describe ApplicationController do
end
it 'renders a 403 when a message is passed to access denied' do
- get :index, message: 'None shall pass'
+ get :index, params: { message: 'None shall pass' }
expect(response).to have_gitlab_http_status(403)
end
it 'renders a status passed to access denied' do
- get :index, status: 401
+ get :index, params: { status: 401 }
expect(response).to have_gitlab_http_status(401)
end
@@ -548,7 +548,7 @@ describe ApplicationController do
end
context 'html' do
- subject { get :index, text: "hi \255" }
+ subject { get :index, params: { text: "hi \255" } }
it 'renders 412' do
expect { subject }.to raise_error(ActionController::BadRequest)
@@ -556,7 +556,7 @@ describe ApplicationController do
end
context 'js' do
- subject { get :index, text: "hi \255", format: :js }
+ subject { get :index, format: :js, params: { text: "hi \255" } }
it 'renders 412' do
expect { subject }.to raise_error(ActionController::BadRequest)
diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb
index 883bb35f396..4458a7223bf 100644
--- a/spec/controllers/autocomplete_controller_spec.rb
+++ b/spec/controllers/autocomplete_controller_spec.rb
@@ -15,7 +15,7 @@ describe AutocompleteController do
describe 'GET #users with project ID' do
before do
- get(:users, project_id: project.id)
+ get(:users, params: { project_id: project.id })
end
it 'returns the project members' do
@@ -27,7 +27,7 @@ describe AutocompleteController do
describe 'GET #users with unknown project' do
before do
- get(:users, project_id: 'unknown')
+ get(:users, params: { project_id: 'unknown' })
end
it { expect(response).to have_gitlab_http_status(404) }
@@ -44,7 +44,7 @@ describe AutocompleteController do
describe 'GET #users with group ID' do
before do
- get(:users, group_id: group.id)
+ get(:users, params: { group_id: group.id })
end
it 'returns the group members' do
@@ -56,7 +56,7 @@ describe AutocompleteController do
describe 'GET #users with unknown group ID' do
before do
- get(:users, group_id: 'unknown')
+ get(:users, params: { group_id: 'unknown' })
end
it { expect(response).to have_gitlab_http_status(404) }
@@ -72,7 +72,7 @@ describe AutocompleteController do
describe 'GET #users with project ID' do
before do
- get(:users, project_id: project.id, current_user: true)
+ get(:users, params: { project_id: project.id, current_user: true })
end
it 'returns the project members and non-members' do
@@ -100,7 +100,7 @@ describe AutocompleteController do
user1 = create(:user, username: 'user1', name: 'Ian')
sign_in(user)
- get(:users, search: 'user')
+ get(:users, params: { search: 'user' })
response_usernames = json_response.map { |user| user['username'] }
@@ -128,7 +128,7 @@ describe AutocompleteController do
describe 'GET #users with public project' do
before do
public_project.add_guest(user)
- get(:users, project_id: public_project.id)
+ get(:users, params: { project_id: public_project.id })
end
it { expect(json_response).to be_kind_of(Array) }
@@ -137,7 +137,7 @@ describe AutocompleteController do
describe 'GET #users with project' do
before do
- get(:users, project_id: project.id)
+ get(:users, params: { project_id: project.id })
end
it { expect(response).to have_gitlab_http_status(404) }
@@ -145,7 +145,7 @@ describe AutocompleteController do
describe 'GET #users with unknown project' do
before do
- get(:users, project_id: 'unknown')
+ get(:users, params: { project_id: 'unknown' })
end
it { expect(response).to have_gitlab_http_status(404) }
@@ -154,7 +154,7 @@ describe AutocompleteController do
describe 'GET #users with inaccessible group' do
before do
project.add_guest(user)
- get(:users, group_id: user.namespace.id)
+ get(:users, params: { group_id: user.namespace.id })
end
it { expect(response).to have_gitlab_http_status(404) }
@@ -171,7 +171,7 @@ describe AutocompleteController do
describe 'GET #users with todo filter' do
it 'gives an array of users' do
- get :users, todo_filter: true
+ get :users, params: { todo_filter: true }
expect(response.status).to eq 200
expect(json_response).to be_kind_of(Array)
@@ -186,13 +186,13 @@ describe AutocompleteController do
end
it 'includes the author' do
- get(:users, author_id: non_member.id)
+ get(:users, params: { author_id: non_member.id })
expect(json_response.first["username"]).to eq non_member.username
end
it 'rejects non existent user ids' do
- get(:users, author_id: 99999)
+ get(:users, params: { author_id: 99999 })
expect(json_response.collect { |u| u['id'] }).not_to include(99999)
end
@@ -200,7 +200,7 @@ describe AutocompleteController do
context 'without authenticating' do
it 'returns empty result' do
- get(:users, author_id: non_member.id)
+ get(:users, params: { author_id: non_member.id })
expect(json_response).to be_empty
end
@@ -213,7 +213,7 @@ describe AutocompleteController do
end
it 'skips the user IDs passed' do
- get(:users, skip_users: [user, user2].map(&:id))
+ get(:users, params: { skip_users: [user, user2].map(&:id) })
response_user_ids = json_response.map { |user| user['id'] }
@@ -238,7 +238,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID' do
before do
- get(:projects, project_id: project.id)
+ get(:projects, params: { project_id: project.id })
end
it 'returns projects' do
@@ -259,7 +259,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID and search' do
before do
- get(:projects, project_id: project.id, search: 'rugged')
+ get(:projects, params: { project_id: project.id, search: 'rugged' })
end
it 'returns projects' do
@@ -283,7 +283,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID' do
before do
- get(:projects, project_id: project.id)
+ get(:projects, params: { project_id: project.id })
end
it 'returns projects' do
@@ -305,7 +305,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID and offset_id' do
before do
- get(:projects, project_id: project.id, offset_id: authorized_project.id)
+ get(:projects, params: { project_id: project.id, offset_id: authorized_project.id })
end
it 'returns projects' do
@@ -324,7 +324,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID' do
before do
- get(:projects, project_id: project.id)
+ get(:projects, params: { project_id: project.id })
end
it 'returns no projects' do
diff --git a/spec/controllers/boards/issues_controller_spec.rb b/spec/controllers/boards/issues_controller_spec.rb
index 6d0483f0032..8657fc2ebc0 100644
--- a/spec/controllers/boards/issues_controller_spec.rb
+++ b/spec/controllers/boards/issues_controller_spec.rb
@@ -153,7 +153,7 @@ describe Boards::IssuesController do
params[:project_id] = project
end
- get :index, params.compact
+ get :index, params: params.compact
end
end
@@ -230,9 +230,11 @@ describe Boards::IssuesController do
def create_issue(user:, board:, list:, title:)
sign_in(user)
- post :create, board_id: board.to_param,
- list_id: list.to_param,
- issue: { title: title, project_id: project.id },
+ post :create, params: {
+ board_id: board.to_param,
+ list_id: list.to_param,
+ issue: { title: title, project_id: project.id }
+ },
format: :json
end
end
@@ -291,12 +293,14 @@ describe Boards::IssuesController do
def move(user:, board:, issue:, from_list_id:, to_list_id:)
sign_in(user)
- patch :update, namespace_id: project.namespace.to_param,
- project_id: project.id,
- board_id: board.to_param,
- id: issue.id,
- from_list_id: from_list_id,
- to_list_id: to_list_id,
+ patch :update, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.id,
+ board_id: board.to_param,
+ id: issue.id,
+ from_list_id: from_list_id,
+ to_list_id: to_list_id
+ },
format: :json
end
end
diff --git a/spec/controllers/boards/lists_controller_spec.rb b/spec/controllers/boards/lists_controller_spec.rb
index 16ccf405247..70033857168 100644
--- a/spec/controllers/boards/lists_controller_spec.rb
+++ b/spec/controllers/boards/lists_controller_spec.rb
@@ -46,9 +46,11 @@ describe Boards::ListsController do
def read_board_list(user:, board:)
sign_in(user)
- get :index, namespace_id: project.namespace.to_param,
- project_id: project,
- board_id: board.to_param,
+ get :index, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ board_id: board.to_param
+ },
format: :json
end
end
@@ -103,10 +105,12 @@ describe Boards::ListsController do
def create_board_list(user:, board:, label_id:)
sign_in(user)
- post :create, namespace_id: project.namespace.to_param,
- project_id: project,
- board_id: board.to_param,
- list: { label_id: label_id },
+ post :create, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ board_id: board.to_param,
+ list: { label_id: label_id }
+ },
format: :json
end
end
@@ -201,10 +205,12 @@ describe Boards::ListsController do
def remove_board_list(user:, board:, list:)
sign_in(user)
- delete :destroy, namespace_id: project.namespace.to_param,
- project_id: project,
- board_id: board.to_param,
- id: list.to_param,
+ delete :destroy, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ board_id: board.to_param,
+ id: list.to_param
+ },
format: :json
end
end
@@ -245,9 +251,11 @@ describe Boards::ListsController do
def generate_default_lists(user:, board:)
sign_in(user)
- post :generate, namespace_id: project.namespace.to_param,
- project_id: project,
- board_id: board.to_param,
+ post :generate, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ board_id: board.to_param
+ },
format: :json
end
end
diff --git a/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb b/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb
index 3c9452cc42a..9b2d054f4fc 100644
--- a/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb
+++ b/spec/controllers/concerns/controller_with_cross_project_access_check_spec.rb
@@ -70,7 +70,7 @@ describe ControllerWithCrossProjectAccessCheck do
end
it 'correctly renders an action that does not require cross project access' do
- get :show, id: 'nothing'
+ get :show, params: { id: 'nothing' }
expect(response).to have_gitlab_http_status(200)
end
@@ -131,13 +131,13 @@ describe ControllerWithCrossProjectAccessCheck do
end
it 'does not skip the check on an action that is not skipped' do
- get :show, id: 'hello'
+ get :show, params: { id: 'hello' }
expect(response).to have_gitlab_http_status(403)
end
it 'does not skip the check on an action that was not defined to skip' do
- get :edit, id: 'hello'
+ get :edit, params: { id: 'hello' }
expect(response).to have_gitlab_http_status(403)
end
diff --git a/spec/controllers/concerns/group_tree_spec.rb b/spec/controllers/concerns/group_tree_spec.rb
index 503eb416962..9fe17210d50 100644
--- a/spec/controllers/concerns/group_tree_spec.rb
+++ b/spec/controllers/concerns/group_tree_spec.rb
@@ -23,7 +23,7 @@ describe GroupTree do
other_group = create(:group, name: 'filter')
other_group.add_owner(user)
- get :index, filter: 'filt', format: :json
+ get :index, params: { filter: 'filt' }, format: :json
expect(assigns(:groups)).to contain_exactly(other_group)
end
@@ -40,7 +40,7 @@ describe GroupTree do
it 'contains only the subgroup when a parent was given' do
subgroup = create(:group, :public, parent: group)
- get :index, parent_id: group.id, format: :json
+ get :index, params: { parent_id: group.id }, format: :json
expect(assigns(:groups)).to contain_exactly(subgroup)
end
@@ -48,7 +48,7 @@ describe GroupTree do
it 'allows filtering for subgroups and includes the parents for rendering' do
subgroup = create(:group, :public, parent: group, name: 'filter')
- get :index, filter: 'filt', format: :json
+ get :index, params: { filter: 'filt' }, format: :json
expect(assigns(:groups)).to contain_exactly(group, subgroup)
end
@@ -59,7 +59,7 @@ describe GroupTree do
subgroup.add_developer(user)
_other_subgroup = create(:group, :private, parent: parent, name: 'filte')
- get :index, filter: 'filt', format: :json
+ get :index, params: { filter: 'filt' }, format: :json
expect(assigns(:groups)).to contain_exactly(parent, subgroup)
end
@@ -70,7 +70,7 @@ describe GroupTree do
subgroup = create(:group, :public, parent: group)
search_result = create(:group, :public, name: 'result', parent: subgroup)
- get :index, filter: 'resu', format: :json
+ get :index, params: { filter: 'resu' }, format: :json
expect(assigns(:groups)).to contain_exactly(group, subgroup, search_result)
end
@@ -87,7 +87,7 @@ describe GroupTree do
it 'expands the tree when filtering' do
subgroup = create(:group, :public, parent: group, name: 'filter')
- get :index, filter: 'filt', format: :json
+ get :index, params: { filter: 'filt' }, format: :json
children_response = json_response.first['children']
diff --git a/spec/controllers/concerns/lfs_request_spec.rb b/spec/controllers/concerns/lfs_request_spec.rb
index 76c878ec5d7..7b49d4b6a3a 100644
--- a/spec/controllers/concerns/lfs_request_spec.rb
+++ b/spec/controllers/concerns/lfs_request_spec.rb
@@ -34,7 +34,7 @@ describe LfsRequest do
describe '#storage_project' do
it 'assigns the project as storage project' do
- get :show, id: project.id
+ get :show, params: { id: project.id }
expect(assigns(:storage_project)).to eq(project)
end
@@ -42,7 +42,7 @@ describe LfsRequest do
it 'assigns the source of a forked project' do
forked_project = fork_project(project)
- get :show, id: forked_project.id
+ get :show, params: { id: forked_project.id }
expect(assigns(:storage_project)).to eq(project)
end
diff --git a/spec/controllers/dashboard/groups_controller_spec.rb b/spec/controllers/dashboard/groups_controller_spec.rb
index 9068c1a792e..c8d99f79277 100644
--- a/spec/controllers/dashboard/groups_controller_spec.rb
+++ b/spec/controllers/dashboard/groups_controller_spec.rb
@@ -33,7 +33,7 @@ describe Dashboard::GroupsController do
end
it 'renders only groups the user is a member of when searching hierarchy correctly' do
- get :index, filter: 'chef', format: :json
+ get :index, params: { filter: 'chef' }, format: :json
expect(response).to have_gitlab_http_status(200)
all_groups = [top_level_result, top_level_a, sub_level_result_a]
diff --git a/spec/controllers/dashboard/milestones_controller_spec.rb b/spec/controllers/dashboard/milestones_controller_spec.rb
index 278b980b6d8..8a8cc14fd4c 100644
--- a/spec/controllers/dashboard/milestones_controller_spec.rb
+++ b/spec/controllers/dashboard/milestones_controller_spec.rb
@@ -34,7 +34,7 @@ describe Dashboard::MilestonesController do
render_views
def view_milestone
- get :show, id: milestone.safe_title, title: milestone.title
+ get :show, params: { id: milestone.safe_title, title: milestone.title }
end
it 'shows milestone page' do
diff --git a/spec/controllers/dashboard/todos_controller_spec.rb b/spec/controllers/dashboard/todos_controller_spec.rb
index e2c799f5205..d88beaff0e1 100644
--- a/spec/controllers/dashboard/todos_controller_spec.rb
+++ b/spec/controllers/dashboard/todos_controller_spec.rb
@@ -16,19 +16,19 @@ describe Dashboard::TodosController do
it 'renders 404 when user does not have read access on given project' do
unauthorized_project = create(:project, :private)
- get :index, project_id: unauthorized_project.id
+ get :index, params: { project_id: unauthorized_project.id }
expect(response).to have_gitlab_http_status(404)
end
it 'renders 404 when given project does not exists' do
- get :index, project_id: 999
+ get :index, params: { project_id: 999 }
expect(response).to have_gitlab_http_status(404)
end
it 'renders 200 when filtering for "any project" todos' do
- get :index, project_id: ''
+ get :index, params: { project_id: '' }
expect(response).to have_gitlab_http_status(200)
end
@@ -36,7 +36,7 @@ describe Dashboard::TodosController do
it 'renders 200 when user has access on given project' do
authorized_project = create(:project, :public)
- get :index, project_id: authorized_project.id
+ get :index, params: { project_id: authorized_project.id }
expect(response).to have_gitlab_http_status(200)
end
@@ -46,7 +46,7 @@ describe Dashboard::TodosController do
it 'renders 404 when user does not have read access on given group' do
unauthorized_group = create(:group, :private)
- get :index, group_id: unauthorized_group.id
+ get :index, params: { group_id: unauthorized_group.id }
expect(response).to have_gitlab_http_status(404)
end
@@ -62,13 +62,13 @@ describe Dashboard::TodosController do
end
it 'redirects to last_page if page number is larger than number of pages' do
- get :index, page: (last_page + 1).to_param
+ get :index, params: { page: (last_page + 1).to_param }
expect(response).to redirect_to(dashboard_todos_path(page: last_page))
end
it 'goes to the correct page' do
- get :index, page: last_page
+ get :index, params: { page: last_page }
expect(assigns(:todos).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(200)
@@ -76,7 +76,7 @@ describe Dashboard::TodosController do
it 'does not redirect to external sites when provided a host field' do
external_host = "www.example.com"
- get :index, page: (last_page + 1).to_param, host: external_host
+ get :index, params: { page: (last_page + 1).to_param, host: external_host }
expect(response).to redirect_to(dashboard_todos_path(page: last_page))
end
@@ -87,7 +87,7 @@ describe Dashboard::TodosController do
expect(user).to receive(:todos_pending_count).and_call_original
- get :index, page: (last_page + 1).to_param, sort: :created_asc
+ get :index, params: { page: (last_page + 1).to_param, sort: :created_asc }
expect(response).to redirect_to(dashboard_todos_path(page: last_page, sort: :created_asc))
end
@@ -99,7 +99,7 @@ describe Dashboard::TodosController do
expect(user).not_to receive(:todos_pending_count)
- get :index, page: (last_page + 1).to_param, project_id: project.id
+ get :index, params: { page: (last_page + 1).to_param, project_id: project.id }
expect(response).to redirect_to(dashboard_todos_path(page: last_page, project_id: project.id))
end
@@ -111,7 +111,7 @@ describe Dashboard::TodosController do
let(:todo) { create(:todo, :done, user: user, project: project, author: author) }
it 'restores the todo to pending state' do
- patch :restore, id: todo.id
+ patch :restore, params: { id: todo.id }
expect(todo.reload).to be_pending
expect(response).to have_gitlab_http_status(200)
@@ -123,7 +123,7 @@ describe Dashboard::TodosController do
let(:todos) { create_list(:todo, 2, :done, user: user, project: project, author: author) }
it 'restores the todos to pending state' do
- patch :bulk_restore, ids: todos.map(&:id)
+ patch :bulk_restore, params: { ids: todos.map(&:id) }
todos.each do |todo|
expect(todo.reload).to be_pending
diff --git a/spec/controllers/explore/projects_controller_spec.rb b/spec/controllers/explore/projects_controller_spec.rb
index 2845f258f6f..d57367e931e 100644
--- a/spec/controllers/explore/projects_controller_spec.rb
+++ b/spec/controllers/explore/projects_controller_spec.rb
@@ -12,13 +12,13 @@ describe Explore::ProjectsController do
end
it 'sorts by last updated' do
- get :trending, sort: 'updated_desc'
+ get :trending, params: { sort: 'updated_desc' }
expect(assigns(:projects)).to eq [project2, project1]
end
it 'sorts by oldest updated' do
- get :trending, sort: 'updated_asc'
+ get :trending, params: { sort: 'updated_asc' }
expect(assigns(:projects)).to eq [project1, project2]
end
diff --git a/spec/controllers/google_api/authorizations_controller_spec.rb b/spec/controllers/google_api/authorizations_controller_spec.rb
index 80d553f0f34..1e8e82da4f3 100644
--- a/spec/controllers/google_api/authorizations_controller_spec.rb
+++ b/spec/controllers/google_api/authorizations_controller_spec.rb
@@ -6,7 +6,7 @@ describe GoogleApi::AuthorizationsController do
let(:token) { 'token' }
let(:expires_at) { 1.hour.since.strftime('%s') }
- subject { get :callback, code: 'xxx', state: @state }
+ subject { get :callback, params: { code: 'xxx', state: @state } }
before do
sign_in(user)
diff --git a/spec/controllers/graphql_controller_spec.rb b/spec/controllers/graphql_controller_spec.rb
index 949ad532365..a0f40874db1 100644
--- a/spec/controllers/graphql_controller_spec.rb
+++ b/spec/controllers/graphql_controller_spec.rb
@@ -103,7 +103,7 @@ describe GraphqlController do
}
QUERY
- post :execute, query: query, operationName: 'Echo', variables: variables, private_token: private_token
+ post :execute, params: { query: query, operationName: 'Echo', variables: variables, private_token: private_token }
end
def query_response
diff --git a/spec/controllers/groups/avatars_controller_spec.rb b/spec/controllers/groups/avatars_controller_spec.rb
index 7feecd0c380..772d1d0c1dd 100644
--- a/spec/controllers/groups/avatars_controller_spec.rb
+++ b/spec/controllers/groups/avatars_controller_spec.rb
@@ -10,7 +10,7 @@ describe Groups::AvatarsController do
end
it 'removes avatar from DB calling destroy' do
- delete :destroy, group_id: group.path
+ delete :destroy, params: { group_id: group.path }
@group = assigns(:group)
expect(@group.avatar.present?).to be_falsey
expect(@group).to be_valid
diff --git a/spec/controllers/groups/boards_controller_spec.rb b/spec/controllers/groups/boards_controller_spec.rb
index 99429c93b82..4228e727b52 100644
--- a/spec/controllers/groups/boards_controller_spec.rb
+++ b/spec/controllers/groups/boards_controller_spec.rb
@@ -105,7 +105,7 @@ describe Groups::BoardsController do
end
def list_boards(format: :html)
- get :index, group_id: group, format: format
+ get :index, params: { group_id: group }, format: format
end
end
@@ -183,8 +183,10 @@ describe Groups::BoardsController do
end
def read_board(board:, format: :html)
- get :show, group_id: group,
- id: board.to_param,
+ get :show, params: {
+ group_id: group,
+ id: board.to_param
+ },
format: format
end
end
diff --git a/spec/controllers/groups/children_controller_spec.rb b/spec/controllers/groups/children_controller_spec.rb
index 22d3076c269..4d5bb1488ab 100644
--- a/spec/controllers/groups/children_controller_spec.rb
+++ b/spec/controllers/groups/children_controller_spec.rb
@@ -16,7 +16,7 @@ describe Groups::ChildrenController do
end
it 'shows all children' do
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
expect(assigns(:children)).to contain_exactly(public_project, private_project)
end
@@ -26,7 +26,7 @@ describe Groups::ChildrenController do
group_member.destroy!
private_project.add_guest(user)
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
expect(assigns(:children)).to contain_exactly(public_project, private_project)
end
@@ -35,7 +35,7 @@ describe Groups::ChildrenController do
context 'as a guest' do
it 'shows the public children' do
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
expect(assigns(:children)).to contain_exactly(public_project)
end
@@ -54,7 +54,7 @@ describe Groups::ChildrenController do
end
it 'shows all children' do
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
expect(assigns(:children)).to contain_exactly(public_subgroup, private_subgroup, public_project, private_project)
end
@@ -65,7 +65,7 @@ describe Groups::ChildrenController do
private_subgroup.add_guest(user)
private_project.add_guest(user)
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
expect(assigns(:children)).to contain_exactly(public_subgroup, private_subgroup, public_project, private_project)
end
@@ -74,7 +74,7 @@ describe Groups::ChildrenController do
context 'as a guest' do
it 'shows the public children' do
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
expect(assigns(:children)).to contain_exactly(public_subgroup, public_project)
end
@@ -84,7 +84,7 @@ describe Groups::ChildrenController do
it 'expands the tree for matching projects' do
project = create(:project, :public, namespace: public_subgroup, name: 'filterme')
- get :index, group_id: group.to_param, filter: 'filter', format: :json
+ get :index, params: { group_id: group.to_param, filter: 'filter' }, format: :json
group_json = json_response.first
project_json = group_json['children'].first
@@ -96,7 +96,7 @@ describe Groups::ChildrenController do
it 'expands the tree for matching subgroups' do
matched_group = create(:group, :public, parent: public_subgroup, name: 'filterme')
- get :index, group_id: group.to_param, filter: 'filter', format: :json
+ get :index, params: { group_id: group.to_param, filter: 'filter' }, format: :json
group_json = json_response.first
matched_group_json = group_json['children'].first
@@ -113,7 +113,7 @@ describe Groups::ChildrenController do
l3_subgroup = create(:group, :public, parent: l2_subgroup, path: 'wifi-group')
matched_project_2 = create(:project, :public, namespace: l3_subgroup, name: 'mobile')
- get :index, group_id: group.to_param, filter: 'mobile', format: :json
+ get :index, params: { group_id: group.to_param, filter: 'mobile' }, format: :json
shared_group_json = json_response.first
expect(shared_group_json['id']).to eq(shared_subgroup.id)
@@ -136,7 +136,7 @@ describe Groups::ChildrenController do
l2_subgroup = create(:group, :public, parent: subgroup)
create(:project, :public, namespace: l2_subgroup, name: 'test')
- get :index, group_id: subgroup.to_param, filter: 'test', format: :json
+ get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json
expect(response).to have_http_status(200)
end
@@ -144,7 +144,7 @@ describe Groups::ChildrenController do
it 'returns an array with one element when only one result is matched' do
create(:project, :public, namespace: group, name: 'match')
- get :index, group_id: group.to_param, filter: 'match', format: :json
+ get :index, params: { group_id: group.to_param, filter: 'match' }, format: :json
expect(json_response).to be_kind_of(Array)
expect(json_response.size).to eq(1)
@@ -155,7 +155,7 @@ describe Groups::ChildrenController do
l2_subgroup = create(:group, :public, parent: subgroup)
create(:project, :public, namespace: l2_subgroup, name: 'no-match')
- get :index, group_id: subgroup.to_param, filter: 'test', format: :json
+ get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json
expect(json_response).to eq([])
end
@@ -179,7 +179,7 @@ describe Groups::ChildrenController do
end
group_to_nest.update!(parent: subgroup)
- get :index, group_id: group.to_param, filter: 'filter', per_page: 3, format: :json
+ get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 3 }, format: :json
expect(response).to have_gitlab_http_status(200)
end
@@ -187,7 +187,7 @@ describe Groups::ChildrenController do
it 'includes pagination headers' do
2.times { |i| create(:group, :public, parent: public_subgroup, name: "filterme#{i}") }
- get :index, group_id: group.to_param, filter: 'filter', per_page: 1, format: :json
+ get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 1 }, format: :json
expect(response).to include_pagination_headers
end
@@ -203,7 +203,7 @@ describe Groups::ChildrenController do
let(:expected_queries_per_project) { 0 }
def get_list
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
end
it 'queries the expected amount for a group row' do
@@ -227,7 +227,7 @@ describe Groups::ChildrenController do
let(:extra_queries_for_hierarchies) { 1 }
def get_filtered_list
- get :index, group_id: group.to_param, filter: 'filter', format: :json
+ get :index, params: { group_id: group.to_param, filter: 'filter' }, format: :json
end
it 'queries the expected amount when nested rows are increased for a group' do
@@ -276,13 +276,13 @@ describe Groups::ChildrenController do
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group ) }
it 'has projects on the first page' do
- get :index, group_id: group.to_param, sort: 'id_desc', format: :json
+ get :index, params: { group_id: group.to_param, sort: 'id_desc' }, format: :json
expect(assigns(:children)).to contain_exactly(*first_page_projects)
end
it 'has projects on the second page' do
- get :index, group_id: group.to_param, sort: 'id_desc', page: 2, format: :json
+ get :index, params: { group_id: group.to_param, sort: 'id_desc', page: 2 }, format: :json
expect(assigns(:children)).to contain_exactly(other_project)
end
@@ -294,13 +294,13 @@ describe Groups::ChildrenController do
let!(:next_page_projects) { create_list(:project, per_page, :public, namespace: group) }
it 'contains all subgroups' do
- get :index, group_id: group.to_param, sort: 'id_asc', format: :json
+ get :index, params: { group_id: group.to_param, sort: 'id_asc' }, format: :json
expect(assigns(:children)).to contain_exactly(*first_page_subgroups)
end
it 'contains the project and group on the second page' do
- get :index, group_id: group.to_param, sort: 'id_asc', page: 2, format: :json
+ get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json
expect(assigns(:children)).to contain_exactly(other_subgroup, *next_page_projects.take(per_page - 1))
end
@@ -310,7 +310,7 @@ describe Groups::ChildrenController do
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group) }
it 'correctly calculates the counts' do
- get :index, group_id: group.to_param, sort: 'id_asc', page: 2, format: :json
+ get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json
expect(response).to have_gitlab_http_status(200)
end
diff --git a/spec/controllers/groups/clusters/applications_controller_spec.rb b/spec/controllers/groups/clusters/applications_controller_spec.rb
index 68a798542b6..dd5263b077c 100644
--- a/spec/controllers/groups/clusters/applications_controller_spec.rb
+++ b/spec/controllers/groups/clusters/applications_controller_spec.rb
@@ -81,7 +81,7 @@ describe Groups::Clusters::ApplicationsController do
end
def go
- post :create, params.merge(group_id: group)
+ post :create, params: params.merge(group_id: group)
end
end
end
diff --git a/spec/controllers/groups/clusters_controller_spec.rb b/spec/controllers/groups/clusters_controller_spec.rb
index 6e130f830a2..0f28499194e 100644
--- a/spec/controllers/groups/clusters_controller_spec.rb
+++ b/spec/controllers/groups/clusters_controller_spec.rb
@@ -17,7 +17,7 @@ describe Groups::ClustersController do
describe 'GET index' do
def go(params = {})
- get :index, params.reverse_merge(group_id: group)
+ get :index, params: params.reverse_merge(group_id: group)
end
context 'when feature flag is not enabled' do
@@ -104,7 +104,7 @@ describe Groups::ClustersController do
describe 'GET new' do
def go
- get :new, group_id: group
+ get :new, params: { group_id: group }
end
describe 'functionality for new cluster' do
@@ -198,7 +198,7 @@ describe Groups::ClustersController do
end
def go
- post :create_gcp, params.merge(group_id: group)
+ post :create_gcp, params: params.merge(group_id: group)
end
describe 'functionality' do
@@ -287,7 +287,7 @@ describe Groups::ClustersController do
end
def go
- post :create_user, params.merge(group_id: group)
+ post :create_user, params: params.merge(group_id: group)
end
describe 'functionality' do
@@ -353,8 +353,10 @@ describe Groups::ClustersController do
def go
get :cluster_status,
- group_id: group.to_param,
- id: cluster,
+ params: {
+ group_id: group.to_param,
+ id: cluster
+ },
format: :json
end
@@ -390,8 +392,10 @@ describe Groups::ClustersController do
def go
get :show,
- group_id: group,
- id: cluster
+ params: {
+ group_id: group,
+ id: cluster
+ }
end
describe 'functionality' do
@@ -417,7 +421,7 @@ describe Groups::ClustersController do
describe 'PUT update' do
def go(format: :html)
- put :update, params.merge(
+ put :update, params: params.merge(
group_id: group.to_param,
id: cluster,
format: format
@@ -505,8 +509,10 @@ describe Groups::ClustersController do
def go
delete :destroy,
- group_id: group,
- id: cluster
+ params: {
+ group_id: group,
+ id: cluster
+ }
end
describe 'functionality' do
diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb
index 362d5cc4514..00a00306ff9 100644
--- a/spec/controllers/groups/group_members_controller_spec.rb
+++ b/spec/controllers/groups/group_members_controller_spec.rb
@@ -6,7 +6,7 @@ describe Groups::GroupMembersController do
describe 'GET index' do
it 'renders index with 200 status code' do
- get :index, group_id: group
+ get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:index)
@@ -26,9 +26,11 @@ describe Groups::GroupMembersController do
end
it 'returns 403' 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
+ }
expect(response).to have_gitlab_http_status(403)
expect(group.users).not_to include group_user
@@ -41,9 +43,11 @@ describe Groups::GroupMembersController do
end
it 'adds user to members' 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
+ }
expect(response).to set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(group_group_members_path(group))
@@ -51,9 +55,11 @@ describe Groups::GroupMembersController do
end
it 'adds no user to members' do
- post :create, group_id: group,
- user_ids: '',
- access_level: Gitlab::Access::GUEST
+ post :create, params: {
+ group_id: group,
+ user_ids: '',
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to set_flash.to 'No users specified.'
expect(response).to redirect_to(group_group_members_path(group))
@@ -90,7 +96,7 @@ describe Groups::GroupMembersController do
context 'when member is not found' do
it 'returns 403' do
- delete :destroy, group_id: group, id: 42
+ delete :destroy, params: { group_id: group, id: 42 }
expect(response).to have_gitlab_http_status(403)
end
@@ -103,7 +109,7 @@ describe Groups::GroupMembersController do
end
it 'returns 403' do
- delete :destroy, group_id: group, id: member
+ delete :destroy, params: { group_id: group, id: member }
expect(response).to have_gitlab_http_status(403)
expect(group.members).to include member
@@ -116,7 +122,7 @@ describe Groups::GroupMembersController do
end
it '[HTML] removes user from members' do
- delete :destroy, group_id: group, id: member
+ delete :destroy, params: { group_id: group, id: member }
expect(response).to set_flash.to 'User was successfully removed from group.'
expect(response).to redirect_to(group_group_members_path(group))
@@ -140,7 +146,7 @@ describe Groups::GroupMembersController do
context 'when member is not found' do
it 'returns 404' do
- delete :leave, group_id: group
+ delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(404)
end
@@ -153,7 +159,7 @@ describe Groups::GroupMembersController do
end
it 'removes user from members' do
- delete :leave, group_id: group
+ delete :leave, params: { group_id: group }
expect(response).to set_flash.to "You left the \"#{group.name}\" group."
expect(response).to redirect_to(dashboard_groups_path)
@@ -161,7 +167,7 @@ describe Groups::GroupMembersController do
end
it 'supports json request' do
- delete :leave, group_id: group, format: :json
+ delete :leave, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(json_response['notice']).to eq "You left the \"#{group.name}\" group."
@@ -174,7 +180,7 @@ describe Groups::GroupMembersController do
end
it 'cannot removes himself from the group' do
- delete :leave, group_id: group
+ delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(403)
end
@@ -186,7 +192,7 @@ describe Groups::GroupMembersController do
end
it 'removes user from members' do
- delete :leave, group_id: group
+ delete :leave, params: { group_id: group }
expect(response).to set_flash.to 'Your access request to the group has been withdrawn.'
expect(response).to redirect_to(group_path(group))
@@ -203,7 +209,7 @@ describe Groups::GroupMembersController do
end
it 'creates a new GroupMember that is not a team member' do
- post :request_access, group_id: group
+ post :request_access, params: { group_id: group }
expect(response).to set_flash.to 'Your request for access has been queued for review.'
expect(response).to redirect_to(group_path(group))
@@ -221,7 +227,7 @@ describe Groups::GroupMembersController do
context 'when member is not found' do
it 'returns 403' do
- post :approve_access_request, group_id: group, id: 42
+ post :approve_access_request, params: { group_id: group, id: 42 }
expect(response).to have_gitlab_http_status(403)
end
@@ -234,7 +240,7 @@ describe Groups::GroupMembersController do
end
it 'returns 403' do
- post :approve_access_request, group_id: group, id: member
+ post :approve_access_request, params: { group_id: group, id: member }
expect(response).to have_gitlab_http_status(403)
expect(group.members).not_to include member
@@ -247,7 +253,7 @@ describe Groups::GroupMembersController do
end
it 'adds user to members' do
- post :approve_access_request, group_id: group, id: member
+ post :approve_access_request, params: { group_id: group, id: member }
expect(response).to redirect_to(group_group_members_path(group))
expect(group.members).to include member
diff --git a/spec/controllers/groups/labels_controller_spec.rb b/spec/controllers/groups/labels_controller_spec.rb
index 185b6b4ce57..fa664a29066 100644
--- a/spec/controllers/groups/labels_controller_spec.rb
+++ b/spec/controllers/groups/labels_controller_spec.rb
@@ -16,7 +16,7 @@ describe Groups::LabelsController do
set(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') }
it 'returns group and project labels by default' do
- get :index, group_id: group, format: :json
+ get :index, params: { group_id: group }, format: :json
label_ids = json_response.map {|label| label['title']}
expect(label_ids).to match_array([label_1.title, group_label_1.title])
@@ -31,7 +31,7 @@ describe Groups::LabelsController do
end
it 'returns ancestor group labels', :nested_groups do
- get :index, group_id: subgroup, include_ancestor_groups: true, only_group_labels: true, format: :json
+ get :index, params: { group_id: subgroup, include_ancestor_groups: true, only_group_labels: true }, format: :json
label_ids = json_response.map {|label| label['title']}
expect(label_ids).to match_array([group_label_1.title, subgroup_label_1.title])
@@ -43,7 +43,7 @@ describe Groups::LabelsController do
it 'allows user to toggle subscription on group labels' do
label = create(:group_label, group: group)
- post :toggle_subscription, group_id: group.to_param, id: label.to_param
+ post :toggle_subscription, params: { group_id: group.to_param, id: label.to_param }
expect(response).to have_gitlab_http_status(200)
end
diff --git a/spec/controllers/groups/milestones_controller_spec.rb b/spec/controllers/groups/milestones_controller_spec.rb
index 42723bb3820..b8e1e08cff7 100644
--- a/spec/controllers/groups/milestones_controller_spec.rb
+++ b/spec/controllers/groups/milestones_controller_spec.rb
@@ -33,7 +33,7 @@ describe Groups::MilestonesController do
describe '#index' do
it 'shows group milestones page' do
- get :index, group_id: group.to_param
+ get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200)
end
@@ -44,7 +44,7 @@ describe Groups::MilestonesController do
let!(:legacy_milestone2) { create(:milestone, project: project2, title: 'legacy') }
it 'lists legacy group milestones and group milestones' do
- get :index, group_id: group.to_param, format: :json
+ get :index, params: { group_id: group.to_param }, format: :json
milestones = JSON.parse(response.body)
@@ -67,7 +67,7 @@ describe Groups::MilestonesController do
expect(GlobalMilestone).to receive(:build)
expect(Milestone).not_to receive(:find_by_iid)
- get :show, group_id: group.to_param, id: title, title: milestone1.safe_title
+ get :show, params: { group_id: group.to_param, id: title, title: milestone1.safe_title }
end
end
@@ -76,7 +76,7 @@ describe Groups::MilestonesController do
expect(GlobalMilestone).not_to receive(:build)
expect(Milestone).to receive(:find_by_iid)
- get :show, group_id: group.to_param, id: group_milestone.id
+ get :show, params: { group_id: group.to_param, id: group_milestone.id }
end
end
end
@@ -86,8 +86,10 @@ describe Groups::MilestonesController do
describe "#create" do
it "creates group milestone with Chinese title" do
post :create,
- group_id: group.to_param,
- milestone: milestone_params
+ params: {
+ group_id: group.to_param,
+ milestone: milestone_params
+ }
milestone = Milestone.find_by_title(title)
@@ -105,9 +107,11 @@ describe Groups::MilestonesController do
milestone_params[:title] = "title changed"
put :update,
- id: milestone.iid,
- group_id: group.to_param,
- milestone: milestone_params
+ params: {
+ id: milestone.iid,
+ group_id: group.to_param,
+ milestone: milestone_params
+ }
milestone.reload
expect(response).to redirect_to(group_milestone_path(group, milestone.iid))
@@ -124,10 +128,12 @@ describe Groups::MilestonesController do
milestone_params[:state_event] = "close"
put :update,
- id: milestone1.title.to_slug.to_s,
- group_id: group.to_param,
- milestone: milestone_params,
- title: milestone1.title
+ params: {
+ id: milestone1.title.to_slug.to_s,
+ group_id: group.to_param,
+ milestone: milestone_params,
+ title: milestone1.title
+ }
expect(response).to redirect_to(group_milestone_path(group, milestone1.safe_title, title: milestone1.title))
@@ -145,7 +151,7 @@ describe Groups::MilestonesController do
let(:milestone) { create(:milestone, group: group) }
it "removes milestone" do
- delete :destroy, group_id: group.to_param, id: milestone.iid, format: :js
+ delete :destroy, params: { group_id: group.to_param, id: milestone.iid }, format: :js
expect(response).to be_success
expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound)
@@ -162,7 +168,7 @@ describe Groups::MilestonesController do
context 'non-show path' do
context 'with exactly matching casing' do
it 'does not redirect' do
- get :index, group_id: group.to_param
+ get :index, params: { group_id: group.to_param }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -170,7 +176,7 @@ describe Groups::MilestonesController do
context 'with different casing' do
it 'redirects to the correct casing' do
- get :index, group_id: group.to_param.upcase
+ get :index, params: { group_id: group.to_param.upcase }
expect(response).to redirect_to(group_milestones_path(group.to_param))
expect(controller).not_to set_flash[:notice]
@@ -181,7 +187,7 @@ describe Groups::MilestonesController do
context 'show path' do
context 'with exactly matching casing' do
it 'does not redirect' do
- get :show, group_id: group.to_param, id: title
+ get :show, params: { group_id: group.to_param, id: title }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -189,7 +195,7 @@ describe Groups::MilestonesController do
context 'with different casing' do
it 'redirects to the correct casing' do
- get :show, group_id: group.to_param.upcase, id: title
+ get :show, params: { group_id: group.to_param.upcase, id: title }
expect(response).to redirect_to(group_milestone_path(group.to_param, title))
expect(controller).not_to set_flash[:notice]
@@ -202,7 +208,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
it 'redirects to the canonical path' do
- get :merge_requests, group_id: redirect_route.path, id: title
+ get :merge_requests, params: { group_id: redirect_route.path, id: title }
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -212,7 +218,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
it 'does not modify the requested host' do
- get :merge_requests, group_id: redirect_route.path, id: title
+ get :merge_requests, params: { group_id: redirect_route.path, id: title }
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -224,7 +230,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
it 'does not modify the /groups part of the path' do
- get :merge_requests, group_id: redirect_route.path, id: title
+ get :merge_requests, params: { group_id: redirect_route.path, id: title }
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -236,7 +242,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
it 'does not modify the /groups part of the path' do
- get :merge_requests, group_id: redirect_route.path, id: title
+ get :merge_requests, params: { group_id: redirect_route.path, id: title }
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -250,16 +256,20 @@ describe Groups::MilestonesController do
context 'when requesting the canonical path with different casing' do
it 'does not 404' do
post :create,
- group_id: group.to_param,
- milestone: { title: title }
+ params: {
+ group_id: group.to_param,
+ milestone: { title: title }
+ }
expect(response).not_to have_gitlab_http_status(404)
end
it 'does not redirect to the correct casing' do
post :create,
- group_id: group.to_param,
- milestone: { title: title }
+ params: {
+ group_id: group.to_param,
+ milestone: { title: title }
+ }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -270,8 +280,10 @@ describe Groups::MilestonesController do
it 'returns not found' do
post :create,
- group_id: redirect_route.path,
- milestone: { title: title }
+ params: {
+ group_id: redirect_route.path,
+ milestone: { title: title }
+ }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/groups/runners_controller_spec.rb b/spec/controllers/groups/runners_controller_spec.rb
index 598fb84552f..469459bfc02 100644
--- a/spec/controllers/groups/runners_controller_spec.rb
+++ b/spec/controllers/groups/runners_controller_spec.rb
@@ -22,7 +22,7 @@ describe Groups::RunnersController do
new_desc = runner.description.swapcase
expect do
- post :update, params.merge(runner: { description: new_desc } )
+ post :update, params: params.merge(runner: { description: new_desc } )
end.to change { runner.ensure_runner_queue_value }
runner.reload
@@ -34,7 +34,7 @@ describe Groups::RunnersController do
describe '#destroy' do
it 'destroys the runner' do
- delete :destroy, params
+ delete :destroy, params: params
expect(response).to have_gitlab_http_status(302)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
@@ -46,7 +46,7 @@ describe Groups::RunnersController do
runner.update(active: false)
expect do
- post :resume, params
+ post :resume, params: params
end.to change { runner.ensure_runner_queue_value }
runner.reload
@@ -61,7 +61,7 @@ describe Groups::RunnersController do
runner.update(active: true)
expect do
- post :pause, params
+ post :pause, params: params
end.to change { runner.ensure_runner_queue_value }
runner.reload
diff --git a/spec/controllers/groups/settings/ci_cd_controller_spec.rb b/spec/controllers/groups/settings/ci_cd_controller_spec.rb
index 06ccace8242..b7f04f732b9 100644
--- a/spec/controllers/groups/settings/ci_cd_controller_spec.rb
+++ b/spec/controllers/groups/settings/ci_cd_controller_spec.rb
@@ -11,7 +11,7 @@ describe Groups::Settings::CiCdController do
describe 'GET #show' do
it 'renders show with 200 status code' do
- get :show, group_id: group
+ get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:show)
@@ -19,7 +19,7 @@ describe Groups::Settings::CiCdController do
end
describe 'PUT #reset_registration_token' do
- subject { put :reset_registration_token, group_id: group }
+ subject { put :reset_registration_token, params: { group_id: group } }
it 'resets runner registration token' do
expect { subject }.to change { group.reload.runners_token }
diff --git a/spec/controllers/groups/shared_projects_controller_spec.rb b/spec/controllers/groups/shared_projects_controller_spec.rb
index 003c8c262e7..dab7700cf64 100644
--- a/spec/controllers/groups/shared_projects_controller_spec.rb
+++ b/spec/controllers/groups/shared_projects_controller_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe Groups::SharedProjectsController do
def get_shared_projects(params = {})
- get :index, params.reverse_merge(format: :json, group_id: group.full_path)
+ get :index, params: params.reverse_merge(format: :json, group_id: group.full_path)
end
def share_project(project)
diff --git a/spec/controllers/groups/uploads_controller_spec.rb b/spec/controllers/groups/uploads_controller_spec.rb
index 5a7281ed704..0104ba827da 100644
--- a/spec/controllers/groups/uploads_controller_spec.rb
+++ b/spec/controllers/groups/uploads_controller_spec.rb
@@ -15,6 +15,6 @@ describe Groups::UploadsController do
def post_authorize(verified: true)
request.headers.merge!(workhorse_internal_api_request_header) if verified
- post :authorize, group_id: model.full_path, format: :json
+ post :authorize, params: { group_id: model.full_path }, format: :json
end
end
diff --git a/spec/controllers/groups/variables_controller_spec.rb b/spec/controllers/groups/variables_controller_spec.rb
index e5ac5634f95..29ec3588316 100644
--- a/spec/controllers/groups/variables_controller_spec.rb
+++ b/spec/controllers/groups/variables_controller_spec.rb
@@ -13,7 +13,7 @@ describe Groups::VariablesController do
let!(:variable) { create(:ci_group_variable, group: group) }
subject do
- get :show, group_id: group, format: :json
+ get :show, params: { group_id: group }, format: :json
end
include_examples 'GET #show lists all variables'
@@ -25,8 +25,10 @@ describe Groups::VariablesController do
subject do
patch :update,
- group_id: group,
- variables_attributes: variables_attributes,
+ params: {
+ group_id: group,
+ variables_attributes: variables_attributes
+ },
format: :json
end
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index 4b0dc4c9b69..7d87b33e503 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -15,7 +15,7 @@ describe GroupsController do
it 'renders the new page' do
sign_in(member)
- get :new, parent_id: group.id
+ get :new, params: { parent_id: group.id }
expect(response).to render_template(:new)
end
@@ -25,7 +25,7 @@ describe GroupsController do
it 'renders the 404 page' do
sign_in(member)
- get :new, parent_id: group.id
+ get :new, params: { parent_id: group.id }
expect(response).not_to render_template(:new)
expect(response.status).to eq(404)
@@ -42,7 +42,7 @@ describe GroupsController do
it 'assigns events for all the projects in the group' do
create(:event, project: project)
- get :show, id: group.to_param, format: :atom
+ get :show, params: { id: group.to_param }, format: :atom
expect(assigns(:events)).not_to be_empty
end
@@ -53,7 +53,7 @@ describe GroupsController do
it 'sets the badge API endpoint' do
sign_in(owner)
- get :edit, id: group.to_param
+ get :edit, params: { id: group.to_param }
expect(assigns(:badge_api_endpoint)).not_to be_nil
end
@@ -102,7 +102,7 @@ describe GroupsController do
create(:event, project: project)
end
- get :activity, id: group.to_param, format: :json
+ get :activity, params: { id: group.to_param }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(json_response['count']).to eq(3)
@@ -120,7 +120,7 @@ describe GroupsController do
owner.update_attribute(:can_create_group, can_create_group_status)
sign_in(owner)
- post :create, group: { parent_id: group.id, path: 'subgroup' }
+ post :create, params: { group: { parent_id: group.id, path: 'subgroup' } }
expect(response).to be_redirect
expect(response.body).to match(%r{http://test.host/#{group.path}/subgroup})
@@ -134,7 +134,7 @@ describe GroupsController do
previous_group_count = Group.count
- post :create, group: { parent_id: group.id, path: 'subgroup' }
+ post :create, params: { group: { parent_id: group.id, path: 'subgroup' } }
expect(response).to render_template(:new)
expect(Group.count).to eq(previous_group_count)
@@ -157,7 +157,7 @@ describe GroupsController do
it 'creates the Group' do
original_group_count = Group.count
- post :create, group: { path: 'subgroup' }
+ post :create, params: { group: { path: 'subgroup' } }
expect(Group.count).to eq(original_group_count + 1)
expect(response).to be_redirect
@@ -172,7 +172,7 @@ describe GroupsController do
it 'does not create the Group' do
original_group_count = Group.count
- post :create, group: { path: 'subgroup' }
+ post :create, params: { group: { path: 'subgroup' } }
expect(Group.count).to eq(original_group_count)
expect(response).to render_template(:new)
@@ -215,12 +215,12 @@ describe GroupsController do
context 'sorting by votes' do
it 'sorts most popular issues' do
- get :issues, id: group.to_param, sort: 'upvotes_desc'
+ get :issues, params: { id: group.to_param, sort: 'upvotes_desc' }
expect(assigns(:issues)).to eq [issue_2, issue_1]
end
it 'sorts least popular issues' do
- get :issues, id: group.to_param, sort: 'downvotes_desc'
+ get :issues, params: { id: group.to_param, sort: 'downvotes_desc' }
expect(assigns(:issues)).to eq [issue_2, issue_1]
end
end
@@ -233,19 +233,19 @@ describe GroupsController do
end
it 'works with popularity sort' do
- get :issues, id: group.to_param, search: 'foo', sort: 'popularity'
+ get :issues, params: { id: group.to_param, search: 'foo', sort: 'popularity' }
expect(assigns(:issues)).to eq([issue_1])
end
it 'works with priority sort' do
- get :issues, id: group.to_param, search: 'foo', sort: 'priority'
+ get :issues, params: { id: group.to_param, search: 'foo', sort: 'priority' }
expect(assigns(:issues)).to eq([issue_1])
end
it 'works with label priority sort' do
- get :issues, id: group.to_param, search: 'foo', sort: 'label_priority'
+ get :issues, params: { id: group.to_param, search: 'foo', sort: 'label_priority' }
expect(assigns(:issues)).to eq([issue_1])
end
@@ -266,12 +266,12 @@ describe GroupsController do
context 'sorting by votes' do
it 'sorts most popular merge requests' do
- get :merge_requests, id: group.to_param, sort: 'upvotes_desc'
+ get :merge_requests, params: { id: group.to_param, sort: 'upvotes_desc' }
expect(assigns(:merge_requests)).to eq [merge_request_2, merge_request_1]
end
it 'sorts least popular merge requests' do
- get :merge_requests, id: group.to_param, sort: 'downvotes_desc'
+ get :merge_requests, params: { id: group.to_param, sort: 'downvotes_desc' }
expect(assigns(:merge_requests)).to eq [merge_request_2, merge_request_1]
end
end
@@ -282,7 +282,7 @@ describe GroupsController do
it 'returns 404' do
sign_in(create(:user))
- delete :destroy, id: group.to_param
+ delete :destroy, params: { id: group.to_param }
expect(response.status).to eq(404)
end
@@ -295,12 +295,12 @@ describe GroupsController do
it 'schedules a group destroy' do
Sidekiq::Testing.fake! do
- expect { delete :destroy, id: group.to_param }.to change(GroupDestroyWorker.jobs, :size).by(1)
+ expect { delete :destroy, params: { id: group.to_param } }.to change(GroupDestroyWorker.jobs, :size).by(1)
end
end
it 'redirects to the root path' do
- delete :destroy, id: group.to_param
+ delete :destroy, params: { id: group.to_param }
expect(response).to redirect_to(root_path)
end
@@ -313,7 +313,7 @@ describe GroupsController do
end
it 'updates the path successfully' do
- post :update, id: group.to_param, group: { path: 'new_path' }
+ post :update, params: { id: group.to_param, group: { path: 'new_path' } }
expect(response).to have_gitlab_http_status(302)
expect(controller).to set_flash[:notice]
@@ -321,7 +321,7 @@ describe GroupsController do
it 'does not update the path on error' do
allow_any_instance_of(Group).to receive(:move_dir).and_raise(Gitlab::UpdatePathError)
- post :update, id: group.to_param, group: { path: 'new_path' }
+ post :update, params: { id: group.to_param, group: { path: 'new_path' } }
expect(assigns(:group).errors).not_to be_empty
expect(assigns(:group).path).not_to eq('new_path')
@@ -337,7 +337,7 @@ describe GroupsController do
context 'when requesting groups at the root path' do
before do
allow(request).to receive(:original_fullpath).and_return("/#{group_full_path}")
- get :show, id: group_full_path
+ get :show, params: { id: group_full_path }
end
context 'when requesting the canonical path with different casing' do
@@ -384,7 +384,7 @@ describe GroupsController do
context 'non-show path' do
context 'with exactly matching casing' do
it 'does not redirect' do
- get :issues, id: group.to_param
+ get :issues, params: { id: group.to_param }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -392,7 +392,7 @@ describe GroupsController do
context 'with different casing' do
it 'redirects to the correct casing' do
- get :issues, id: group.to_param.upcase
+ get :issues, params: { id: group.to_param.upcase }
expect(response).to redirect_to(issues_group_path(group.to_param))
expect(controller).not_to set_flash[:notice]
@@ -403,7 +403,7 @@ describe GroupsController do
context 'show path' do
context 'with exactly matching casing' do
it 'does not redirect' do
- get :show, id: group.to_param
+ get :show, params: { id: group.to_param }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -411,7 +411,7 @@ describe GroupsController do
context 'with different casing' do
it 'redirects to the correct casing at the root path' do
- get :show, id: group.to_param.upcase
+ get :show, params: { id: group.to_param.upcase }
expect(response).to redirect_to(group)
expect(controller).not_to set_flash[:notice]
@@ -424,7 +424,7 @@ describe GroupsController do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
it 'redirects to the canonical path' do
- get :issues, id: redirect_route.path
+ get :issues, params: { id: redirect_route.path }
expect(response).to redirect_to(issues_group_path(group.to_param))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -434,7 +434,7 @@ describe GroupsController do
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
it 'does not modify the requested host' do
- get :issues, id: redirect_route.path
+ get :issues, params: { id: redirect_route.path }
expect(response).to redirect_to(issues_group_path(group.to_param))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -446,7 +446,7 @@ describe GroupsController do
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
it 'does not modify the /groups part of the path' do
- get :issues, id: redirect_route.path
+ get :issues, params: { id: redirect_route.path }
expect(response).to redirect_to(issues_group_path(group.to_param))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -458,7 +458,7 @@ describe GroupsController do
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
it 'does not modify the /groups part of the path' do
- get :issues, id: redirect_route.path
+ get :issues, params: { id: redirect_route.path }
expect(response).to redirect_to(issues_group_path(group.to_param))
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
@@ -470,13 +470,13 @@ describe GroupsController do
context 'for a POST request' do
context 'when requesting the canonical path with different casing' do
it 'does not 404' do
- post :update, id: group.to_param.upcase, group: { path: 'new_path' }
+ post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
expect(response).not_to have_gitlab_http_status(404)
end
it 'does not redirect to the correct casing' do
- post :update, id: group.to_param.upcase, group: { path: 'new_path' }
+ post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -486,7 +486,7 @@ describe GroupsController do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
it 'returns not found' do
- post :update, id: redirect_route.path, group: { path: 'new_path' }
+ post :update, params: { id: redirect_route.path, group: { path: 'new_path' } }
expect(response).to have_gitlab_http_status(404)
end
@@ -496,13 +496,13 @@ describe GroupsController do
context 'for a DELETE request' do
context 'when requesting the canonical path with different casing' do
it 'does not 404' do
- delete :destroy, id: group.to_param.upcase
+ delete :destroy, params: { id: group.to_param.upcase }
expect(response).not_to have_gitlab_http_status(404)
end
it 'does not redirect to the correct casing' do
- delete :destroy, id: group.to_param.upcase
+ delete :destroy, params: { id: group.to_param.upcase }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -512,7 +512,7 @@ describe GroupsController do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
it 'returns not found' do
- delete :destroy, id: redirect_route.path
+ delete :destroy, params: { id: redirect_route.path }
expect(response).to have_gitlab_http_status(404)
end
@@ -537,8 +537,10 @@ describe GroupsController do
before do
put :transfer,
- id: group.to_param,
- new_parent_group_id: new_parent_group.id
+ params: {
+ id: group.to_param,
+ new_parent_group_id: new_parent_group.id
+ }
end
it 'should return a notice' do
@@ -556,8 +558,10 @@ describe GroupsController do
before do
put :transfer,
- id: group.to_param,
- new_parent_group_id: ''
+ params: {
+ id: group.to_param,
+ new_parent_group_id: ''
+ }
end
it 'should return a notice' do
@@ -578,8 +582,10 @@ describe GroupsController do
allow_any_instance_of(::Groups::TransferService).to receive(:proceed_to_transfer).and_raise(Gitlab::UpdatePathError, 'namespace directory cannot be moved')
put :transfer,
- id: group.to_param,
- new_parent_group_id: new_parent_group.id
+ params: {
+ id: group.to_param,
+ new_parent_group_id: new_parent_group.id
+ }
end
it 'should return an alert' do
@@ -598,8 +604,10 @@ describe GroupsController do
before do
put :transfer,
- id: group.to_param,
- new_parent_group_id: new_parent_group.id
+ params: {
+ id: group.to_param,
+ new_parent_group_id: new_parent_group.id
+ }
end
it 'should be denied' do
diff --git a/spec/controllers/health_check_controller_spec.rb b/spec/controllers/health_check_controller_spec.rb
index 387ca46ef6f..29e159ad5d7 100644
--- a/spec/controllers/health_check_controller_spec.rb
+++ b/spec/controllers/health_check_controller_spec.rb
@@ -37,7 +37,7 @@ describe HealthCheckController do
end
it 'supports passing the token in query params' do
- get :index, token: token
+ get :index, params: { token: token }
expect(response).to be_success
expect(response.content_type).to eq 'text/plain'
@@ -74,7 +74,7 @@ describe HealthCheckController do
end
it 'supports successful responses for specific checks' do
- get :index, checks: 'email', format: :json
+ get :index, params: { checks: 'email' }, format: :json
expect(response).to be_success
expect(response.content_type).to eq 'application/json'
@@ -124,7 +124,7 @@ describe HealthCheckController do
end
it 'supports failure responses for specific checks' do
- get :index, checks: 'email', format: :json
+ get :index, params: { checks: 'email' }, format: :json
expect(response).to have_gitlab_http_status(500)
expect(response.content_type).to eq 'application/json'
diff --git a/spec/controllers/health_controller_spec.rb b/spec/controllers/health_controller_spec.rb
index ec73c89cb11..f685f2b41c0 100644
--- a/spec/controllers/health_controller_spec.rb
+++ b/spec/controllers/health_controller_spec.rb
@@ -18,7 +18,7 @@ describe HealthController do
shared_context 'endpoint responding with readiness data' do
let(:request_params) { {} }
- subject { get :readiness, request_params }
+ subject { get :readiness, params: request_params }
it 'responds with readiness checks data' do
subject
@@ -112,7 +112,7 @@ describe HealthController do
context 'token passed as URL param' do
it_behaves_like 'endpoint responding with liveness data' do
- subject { get :liveness, token: token }
+ subject { get :liveness, params: { token: token } }
end
end
end
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
index 21d59c62613..5cb284e7e2d 100644
--- a/spec/controllers/help_controller_spec.rb
+++ b/spec/controllers/help_controller_spec.rb
@@ -43,7 +43,7 @@ describe HelpController do
context 'for Markdown formats' do
context 'when requested file exists' do
before do
- get :show, path: 'ssh/README', format: :md
+ get :show, params: { path: 'ssh/README' }, format: :md
end
it 'assigns to @markdown' do
@@ -58,7 +58,7 @@ describe HelpController do
context 'when requested file is missing' do
it 'renders not found' do
- get :show, path: 'foo/bar', format: :md
+ get :show, params: { path: 'foo/bar' }, format: :md
expect(response).to be_not_found
end
end
@@ -68,7 +68,9 @@ describe HelpController do
context 'when requested file exists' do
it 'renders the raw file' do
get :show,
- path: 'user/project/img/labels_default',
+ params: {
+ path: 'user/project/img/labels_default'
+ },
format: :png
expect(response).to be_success
expect(response.content_type).to eq 'image/png'
@@ -79,7 +81,9 @@ describe HelpController do
context 'when requested file is missing' do
it 'renders not found' do
get :show,
- path: 'foo/bar',
+ params: {
+ path: 'foo/bar'
+ },
format: :png
expect(response).to be_not_found
end
@@ -89,7 +93,9 @@ describe HelpController do
context 'for other formats' do
it 'always renders not found' do
get :show,
- path: 'ssh/README',
+ params: {
+ path: 'ssh/README'
+ },
format: :foo
expect(response).to be_not_found
end
diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb
index be49b92d23f..51793f2c048 100644
--- a/spec/controllers/import/bitbucket_controller_spec.rb
+++ b/spec/controllers/import/bitbucket_controller_spec.rb
@@ -237,7 +237,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, nested_namespace, user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :json }
+ post :create, params: { target_namespace: nested_namespace.full_path, new_name: test_name }, format: :json
end
end
@@ -249,7 +249,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json }
+ post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json
end
it 'creates the namespaces' do
@@ -257,7 +257,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } }
+ expect { post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json }
.to change { Namespace.count }.by(2)
end
@@ -266,7 +266,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json }
+ post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json
expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo')
end
@@ -285,7 +285,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json }
+ post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :json
end
it 'creates the namespaces' do
@@ -293,7 +293,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } }
+ expect { post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :json }
.to change { Namespace.count }.by(2)
end
end
@@ -302,7 +302,7 @@ describe Import::BitbucketController do
it 'returns 422 response' do
other_namespace = create(:group, name: 'other_namespace')
- post :create, { target_namespace: other_namespace.name, format: :json }
+ post :create, params: { target_namespace: other_namespace.name }, format: :json
expect(response).to have_gitlab_http_status(422)
end
diff --git a/spec/controllers/import/bitbucket_server_controller_spec.rb b/spec/controllers/import/bitbucket_server_controller_spec.rb
index db912641894..73195463a50 100644
--- a/spec/controllers/import/bitbucket_server_controller_spec.rb
+++ b/spec/controllers/import/bitbucket_server_controller_spec.rb
@@ -42,19 +42,19 @@ describe Import::BitbucketServerController do
.to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything)
.and_return(double(execute: project))
- post :create, project: project_key, repository: repo_slug, format: :json
+ post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(200)
end
it 'returns an error when an invalid project key is used' do
- post :create, project: 'some&project'
+ post :create, params: { project: 'some&project' }
expect(response).to have_gitlab_http_status(422)
end
it 'returns an error when an invalid repository slug is used' do
- post :create, project: 'some-project', repository: 'try*this'
+ post :create, params: { project: 'some-project', repository: 'try*this' }
expect(response).to have_gitlab_http_status(422)
end
@@ -62,7 +62,7 @@ describe Import::BitbucketServerController do
it 'returns an error when the project cannot be found' do
allow(client).to receive(:repo).with(project_key, repo_slug).and_return(nil)
- post :create, project: project_key, repository: repo_slug, format: :json
+ post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(422)
end
@@ -72,7 +72,7 @@ describe Import::BitbucketServerController do
.to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything)
.and_return(double(execute: build(:project)))
- post :create, project: project_key, repository: repo_slug, format: :json
+ post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(422)
end
@@ -80,7 +80,7 @@ describe Import::BitbucketServerController do
it "returns an error when the server can't be contacted" do
expect(client).to receive(:repo).with(project_key, repo_slug).and_raise(BitbucketServer::Client::ServerError)
- post :create, project: project_key, repository: repo_slug, format: :json
+ post :create, params: { project: project_key, repository: repo_slug }, format: :json
expect(response).to have_gitlab_http_status(422)
end
@@ -103,7 +103,7 @@ describe Import::BitbucketServerController do
end
it 'sets the session variables' do
- post :configure, personal_access_token: token, bitbucket_username: username, bitbucket_server_url: url
+ post :configure, params: { personal_access_token: token, bitbucket_username: username, bitbucket_server_url: url }
expect(session[:bitbucket_server_url]).to eq(url)
expect(session[:bitbucket_server_username]).to eq(username)
diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb
index 742f4787126..a874a7d36f6 100644
--- a/spec/controllers/import/gitlab_controller_spec.rb
+++ b/spec/controllers/import/gitlab_controller_spec.rb
@@ -209,7 +209,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, nested_namespace, user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: nested_namespace.full_path, format: :json }
+ post :create, params: { target_namespace: nested_namespace.full_path }, format: :json
end
end
@@ -221,7 +221,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: 'foo/bar', format: :json }
+ post :create, params: { target_namespace: 'foo/bar' }, format: :json
end
it 'creates the namespaces' do
@@ -229,7 +229,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- expect { post :create, { target_namespace: 'foo/bar', format: :json } }
+ expect { post :create, params: { target_namespace: 'foo/bar' }, format: :json }
.to change { Namespace.count }.by(2)
end
@@ -238,7 +238,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: 'foo/bar', format: :json }
+ post :create, params: { target_namespace: 'foo/bar' }, format: :json
expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo')
end
@@ -257,7 +257,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- post :create, { target_namespace: 'foo/foobar/bar', format: :json }
+ post :create, params: { target_namespace: 'foo/foobar/bar' }, format: :json
end
it 'creates the namespaces' do
@@ -265,7 +265,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project))
- expect { post :create, { target_namespace: 'foo/foobar/bar', format: :json } }
+ expect { post :create, params: { target_namespace: 'foo/foobar/bar' }, format: :json }
.to change { Namespace.count }.by(2)
end
end
@@ -274,7 +274,7 @@ describe Import::GitlabController do
it 'returns 422 response' do
other_namespace = create(:group, name: 'other_namespace')
- post :create, { target_namespace: other_namespace.name, format: :json }
+ post :create, params: { target_namespace: other_namespace.name }, format: :json
expect(response).to have_gitlab_http_status(422)
end
diff --git a/spec/controllers/import/gitlab_projects_controller_spec.rb b/spec/controllers/import/gitlab_projects_controller_spec.rb
index cbd1a112602..55bd8ae7182 100644
--- a/spec/controllers/import/gitlab_projects_controller_spec.rb
+++ b/spec/controllers/import/gitlab_projects_controller_spec.rb
@@ -12,14 +12,14 @@ describe Import::GitlabProjectsController do
describe 'POST create' do
context 'with an invalid path' do
it 'redirects with an error' do
- post :create, namespace_id: namespace.id, path: '/test', file: file
+ post :create, params: { namespace_id: namespace.id, path: '/test', file: file }
expect(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302)
end
it 'redirects with an error when a relative path is used' do
- post :create, namespace_id: namespace.id, path: '../test', file: file
+ post :create, params: { namespace_id: namespace.id, path: '../test', file: file }
expect(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302)
@@ -28,7 +28,7 @@ describe Import::GitlabProjectsController do
context 'with a valid path' do
it 'redirects to the new project path' do
- post :create, namespace_id: namespace.id, path: 'test', file: file
+ post :create, params: { namespace_id: namespace.id, path: 'test', file: file }
expect(flash[:notice]).to include('is being imported')
expect(response).to have_gitlab_http_status(302)
diff --git a/spec/controllers/import/google_code_controller_spec.rb b/spec/controllers/import/google_code_controller_spec.rb
index 0763492d88a..3e5ed2afd93 100644
--- a/spec/controllers/import/google_code_controller_spec.rb
+++ b/spec/controllers/import/google_code_controller_spec.rb
@@ -12,7 +12,7 @@ describe Import::GoogleCodeController do
describe "POST callback" do
it "stores Google Takeout dump list in session" do
- post :callback, dump_file: dump_file
+ post :callback, params: { dump_file: dump_file }
expect(session[:google_code_dump]).to be_a(Hash)
expect(session[:google_code_dump]["kind"]).to eq("projecthosting#user")
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb
index 6c09ca7dc66..7bbaf36e4df 100644
--- a/spec/controllers/invites_controller_spec.rb
+++ b/spec/controllers/invites_controller_spec.rb
@@ -12,7 +12,7 @@ describe InvitesController do
describe 'GET #accept' do
it 'accepts user' do
- get :accept, id: token
+ get :accept, params: { id: token }
member.reload
expect(response).to have_gitlab_http_status(302)
@@ -23,7 +23,7 @@ describe InvitesController do
describe 'GET #decline' do
it 'declines user' do
- get :decline, id: token
+ get :decline, params: { id: token }
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound
expect(response).to have_gitlab_http_status(302)
diff --git a/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb b/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb
index 87c10a86cdd..c9d36a16008 100644
--- a/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb
+++ b/spec/controllers/ldap/omniauth_callbacks_controller_spec.rb
@@ -11,7 +11,7 @@ describe Ldap::OmniauthCallbacksController do
it 'respects remember me checkbox' do
expect do
- post provider, remember_me: '1'
+ post provider, params: { remember_me: '1' }
end.to change { user.reload.remember_created_at }.from(nil)
end
@@ -19,7 +19,7 @@ describe Ldap::OmniauthCallbacksController do
let(:user) { create(:omniauth_user, :two_factor_via_otp, extern_uid: uid, provider: provider) }
it 'passes remember_me to the Devise view' do
- post provider, remember_me: '1'
+ post provider, params: { remember_me: '1' }
expect(assigns[:user].remember_me).to eq '1'
end
diff --git a/spec/controllers/notification_settings_controller_spec.rb b/spec/controllers/notification_settings_controller_spec.rb
index a3356a86d4b..cf52ce834b6 100644
--- a/spec/controllers/notification_settings_controller_spec.rb
+++ b/spec/controllers/notification_settings_controller_spec.rb
@@ -13,8 +13,10 @@ describe NotificationSettingsController do
context 'when not authorized' do
it 'redirects to sign in page' do
post :create,
- project_id: project.id,
- notification_setting: { level: :participating }
+ params: {
+ project_id: project.id,
+ notification_setting: { level: :participating }
+ }
expect(response).to redirect_to(new_user_session_path)
end
@@ -41,8 +43,10 @@ describe NotificationSettingsController do
it 'creates notification setting' do
post :create,
- project_id: project.id,
- notification_setting: { level: :participating }
+ params: {
+ project_id: project.id,
+ notification_setting: { level: :participating }
+ }
expect(response.status).to eq 200
expect(notification_setting.level).to eq("participating")
@@ -54,8 +58,10 @@ describe NotificationSettingsController do
context 'with custom settings' do
it 'creates notification setting' do
post :create,
- project_id: project.id,
- notification_setting: { level: :custom }.merge(custom_events)
+ params: {
+ project_id: project.id,
+ notification_setting: { level: :custom }.merge(custom_events)
+ }
expect(response.status).to eq 200
expect(notification_setting.level).to eq("custom")
@@ -72,8 +78,10 @@ describe NotificationSettingsController do
it 'creates notification setting' do
post :create,
- namespace_id: group.id,
- notification_setting: { level: :watch }
+ params: {
+ namespace_id: group.id,
+ notification_setting: { level: :watch }
+ }
expect(response.status).to eq 200
expect(notification_setting.level).to eq("watch")
@@ -85,8 +93,10 @@ describe NotificationSettingsController do
context 'with custom settings' do
it 'creates notification setting' do
post :create,
- namespace_id: group.id,
- notification_setting: { level: :custom }.merge(custom_events)
+ params: {
+ namespace_id: group.id,
+ notification_setting: { level: :custom }.merge(custom_events)
+ }
expect(response.status).to eq 200
expect(notification_setting.level).to eq("custom")
@@ -108,8 +118,10 @@ describe NotificationSettingsController do
it 'returns 404' do
post :create,
- project_id: private_project.id,
- notification_setting: { level: :participating }
+ params: {
+ project_id: private_project.id,
+ notification_setting: { level: :participating }
+ }
expect(response).to have_gitlab_http_status(404)
end
@@ -122,8 +134,10 @@ describe NotificationSettingsController do
context 'when not authorized' do
it 'redirects to sign in page' do
put :update,
- id: notification_setting,
- notification_setting: { level: :participating }
+ params: {
+ id: notification_setting,
+ notification_setting: { level: :participating }
+ }
expect(response).to redirect_to(new_user_session_path)
end
@@ -136,8 +150,10 @@ describe NotificationSettingsController do
it 'returns success' do
put :update,
- id: notification_setting,
- notification_setting: { level: :participating }
+ params: {
+ id: notification_setting,
+ notification_setting: { level: :participating }
+ }
expect(response.status).to eq 200
end
@@ -153,8 +169,10 @@ describe NotificationSettingsController do
it 'returns success' do
put :update,
- id: notification_setting,
- notification_setting: { level: :participating, events: custom_events }
+ params: {
+ id: notification_setting,
+ notification_setting: { level: :participating, events: custom_events }
+ }
expect(response.status).to eq 200
end
@@ -170,8 +188,10 @@ describe NotificationSettingsController do
it 'returns 404' do
put :update,
- id: notification_setting,
- notification_setting: { level: :participating }
+ params: {
+ id: notification_setting,
+ notification_setting: { level: :participating }
+ }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/oauth/applications_controller_spec.rb b/spec/controllers/oauth/applications_controller_spec.rb
index b4219856fc0..caf2b87428b 100644
--- a/spec/controllers/oauth/applications_controller_spec.rb
+++ b/spec/controllers/oauth/applications_controller_spec.rb
@@ -26,7 +26,7 @@ describe Oauth::ApplicationsController do
describe 'POST #create' do
it 'creates an application' do
- post :create, oauth_params
+ post :create, params: oauth_params
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last))
@@ -35,7 +35,7 @@ describe Oauth::ApplicationsController do
it 'redirects back to profile page if OAuth applications are disabled' do
disable_user_oauth
- post :create, oauth_params
+ post :create, params: oauth_params
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(profile_path)
@@ -52,7 +52,7 @@ describe Oauth::ApplicationsController do
}
}
- post :create, invalid_uri_params
+ post :create, params: invalid_uri_params
expect(response.body).to include 'Redirect URI is forbidden by the server'
end
diff --git a/spec/controllers/oauth/authorizations_controller_spec.rb b/spec/controllers/oauth/authorizations_controller_spec.rb
index 8c10ea53a7a..cc8fa2c01b4 100644
--- a/spec/controllers/oauth/authorizations_controller_spec.rb
+++ b/spec/controllers/oauth/authorizations_controller_spec.rb
@@ -30,7 +30,7 @@ describe Oauth::AuthorizationsController do
render_views
it 'returns 200 code and renders view' do
- get :new, params
+ get :new, params: params
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('doorkeeper/authorizations/new')
@@ -40,7 +40,7 @@ describe Oauth::AuthorizationsController do
application.update(trusted: true)
request.session['user_return_to'] = 'http://example.com'
- get :new, params
+ get :new, params: params
expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302)
@@ -57,7 +57,7 @@ describe Oauth::AuthorizationsController do
end
it 'authorizes the request and redirects' do
- get :new, params
+ get :new, params: params
expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302)
diff --git a/spec/controllers/passwords_controller_spec.rb b/spec/controllers/passwords_controller_spec.rb
index 4d31cfedbd2..0af55cf3408 100644
--- a/spec/controllers/passwords_controller_spec.rb
+++ b/spec/controllers/passwords_controller_spec.rb
@@ -22,7 +22,7 @@ describe PasswordsController do
let(:user) { create(:omniauth_user, provider: 'ldapmain', email: 'ldapuser@gitlab.com') }
it 'prevents a password reset' do
- post :create, user: { email: user.email }
+ post :create, params: { user: { email: user.email } }
expect(flash[:alert]).to eq 'Password authentication is unavailable.'
end
diff --git a/spec/controllers/profiles/accounts_controller_spec.rb b/spec/controllers/profiles/accounts_controller_spec.rb
index f8d9d7e39ee..bb2ab27e2dd 100644
--- a/spec/controllers/profiles/accounts_controller_spec.rb
+++ b/spec/controllers/profiles/accounts_controller_spec.rb
@@ -9,7 +9,7 @@ describe Profiles::AccountsController do
end
it 'renders 404 if someone tries to unlink a non existent provider' do
- delete :unlink, provider: 'github'
+ delete :unlink, params: { provider: 'github' }
expect(response).to have_gitlab_http_status(404)
end
@@ -21,7 +21,7 @@ describe Profiles::AccountsController do
it "does not allow to unlink connected account" do
identity = user.identities.last
- delete :unlink, provider: provider.to_s
+ delete :unlink, params: { provider: provider.to_s }
expect(response).to have_gitlab_http_status(302)
expect(user.reload.identities).to include(identity)
@@ -36,7 +36,7 @@ describe Profiles::AccountsController do
it 'allows to unlink connected account' do
identity = user.identities.last
- delete :unlink, provider: provider.to_s
+ delete :unlink, params: { provider: provider.to_s }
expect(response).to have_gitlab_http_status(302)
expect(user.reload.identities).not_to include(identity)
diff --git a/spec/controllers/profiles/emails_controller_spec.rb b/spec/controllers/profiles/emails_controller_spec.rb
index ecf14aad54f..a8a1f96befe 100644
--- a/spec/controllers/profiles/emails_controller_spec.rb
+++ b/spec/controllers/profiles/emails_controller_spec.rb
@@ -11,7 +11,7 @@ describe Profiles::EmailsController do
let(:email_params) { { email: "add_email@example.com" } }
it 'sends an email confirmation' do
- expect { post(:create, { email: email_params }) }.to change { ActionMailer::Base.deliveries.size }
+ expect { post(:create, params: { email: email_params }) }.to change { ActionMailer::Base.deliveries.size }
expect(ActionMailer::Base.deliveries.last.to).to eq [email_params[:email]]
expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions"
end
@@ -23,13 +23,13 @@ describe Profiles::EmailsController do
it 'resends an email confirmation' do
email = user.emails.create(email: 'add_email@example.com')
- expect { put(:resend_confirmation_instructions, { id: email }) }.to change { ActionMailer::Base.deliveries.size }
+ expect { put(:resend_confirmation_instructions, params: { id: email }) }.to change { ActionMailer::Base.deliveries.size }
expect(ActionMailer::Base.deliveries.last.to).to eq [email_params[:email]]
expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions"
end
it 'unable to resend an email confirmation' do
- expect { put(:resend_confirmation_instructions, { id: 1 }) }.not_to change { ActionMailer::Base.deliveries.size }
+ expect { put(:resend_confirmation_instructions, params: { id: 1 }) }.not_to change { ActionMailer::Base.deliveries.size }
end
end
end
diff --git a/spec/controllers/profiles/keys_controller_spec.rb b/spec/controllers/profiles/keys_controller_spec.rb
index d55d15d0db8..5e2cc82bd8c 100644
--- a/spec/controllers/profiles/keys_controller_spec.rb
+++ b/spec/controllers/profiles/keys_controller_spec.rb
@@ -6,7 +6,7 @@ describe Profiles::KeysController do
describe "#get_keys" do
describe "non existent user" do
it "does not generally work" do
- get :get_keys, username: 'not-existent'
+ get :get_keys, params: { username: 'not-existent' }
expect(response).not_to be_success
end
@@ -14,19 +14,19 @@ describe Profiles::KeysController do
describe "user with no keys" do
it "does generally work" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response).to be_success
end
it "renders all keys separated with a new line" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response.body).to eq("")
end
it "responds with text/plain content type" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response.content_type).to eq("text/plain")
end
end
@@ -37,13 +37,13 @@ describe Profiles::KeysController do
let!(:deploy_key) { create(:deploy_key, user: user) }
it "does generally work" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response).to be_success
end
it "renders all non deploy keys separated with a new line" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response.body).not_to eq('')
expect(response.body).to eq(user.all_ssh_keys.join("\n"))
@@ -55,13 +55,13 @@ describe Profiles::KeysController do
end
it "does not render the comment of the key" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response.body).not_to match(/dummy@gitlab.com/)
end
it "responds with text/plain content type" do
- get :get_keys, username: user.username
+ get :get_keys, params: { username: user.username }
expect(response.content_type).to eq("text/plain")
end
diff --git a/spec/controllers/profiles/notifications_controller_spec.rb b/spec/controllers/profiles/notifications_controller_spec.rb
index b97cdd4d489..1b76446a0cf 100644
--- a/spec/controllers/profiles/notifications_controller_spec.rb
+++ b/spec/controllers/profiles/notifications_controller_spec.rb
@@ -24,7 +24,7 @@ describe Profiles::NotificationsController do
it 'updates only permitted attributes' do
sign_in(user)
- put :update, user: { notification_email: 'new@example.com', notified_of_own_activity: true, admin: true }
+ put :update, params: { user: { notification_email: 'new@example.com', notified_of_own_activity: true, admin: true } }
user.reload
expect(user.notification_email).to eq('new@example.com')
@@ -36,7 +36,7 @@ describe Profiles::NotificationsController do
it 'shows an error message if the params are invalid' do
sign_in(user)
- put :update, user: { notification_email: '' }
+ put :update, params: { user: { notification_email: '' } }
expect(user.reload.notification_email).to eq('original@example.com')
expect(controller).to set_flash[:alert].to('Failed to save new settings')
diff --git a/spec/controllers/profiles/personal_access_tokens_controller_spec.rb b/spec/controllers/profiles/personal_access_tokens_controller_spec.rb
index f5860d4296b..021bf2429e3 100644
--- a/spec/controllers/profiles/personal_access_tokens_controller_spec.rb
+++ b/spec/controllers/profiles/personal_access_tokens_controller_spec.rb
@@ -17,7 +17,7 @@ describe Profiles::PersonalAccessTokensController do
name = 'My PAT'
scopes = %w[api read_user]
- post :create, personal_access_token: token_attributes.merge(scopes: scopes, name: name)
+ post :create, params: { personal_access_token: token_attributes.merge(scopes: scopes, name: name) }
expect(created_token).not_to be_nil
expect(created_token.name).to eq(name)
@@ -28,7 +28,7 @@ describe Profiles::PersonalAccessTokensController do
it "allows creation of a token with an expiry date" do
expires_at = 5.days.from_now.to_date
- post :create, personal_access_token: token_attributes.merge(expires_at: expires_at)
+ post :create, params: { personal_access_token: token_attributes.merge(expires_at: expires_at) }
expect(created_token).not_to be_nil
expect(created_token.expires_at).to eq(expires_at)
diff --git a/spec/controllers/profiles/preferences_controller_spec.rb b/spec/controllers/profiles/preferences_controller_spec.rb
index b580e773459..012f016b091 100644
--- a/spec/controllers/profiles/preferences_controller_spec.rb
+++ b/spec/controllers/profiles/preferences_controller_spec.rb
@@ -29,7 +29,7 @@ describe Profiles::PreferencesController do
theme_id: '1'
)
- patch :update, user: params, format: format
+ patch :update, params: { user: params }, format: format
end
context 'on successful update' do
diff --git a/spec/controllers/profiles/two_factor_auths_controller_spec.rb b/spec/controllers/profiles/two_factor_auths_controller_spec.rb
index d08d0018b35..0151a434998 100644
--- a/spec/controllers/profiles/two_factor_auths_controller_spec.rb
+++ b/spec/controllers/profiles/two_factor_auths_controller_spec.rb
@@ -32,7 +32,7 @@ describe Profiles::TwoFactorAuthsController do
let(:pin) { 'pin-code' }
def go
- post :create, pin_code: pin
+ post :create, params: { pin_code: pin }
end
context 'with valid pin' do
diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb
index 360c536c667..11cb59aa12a 100644
--- a/spec/controllers/profiles_controller_spec.rb
+++ b/spec/controllers/profiles_controller_spec.rb
@@ -9,7 +9,7 @@ describe ProfilesController, :request_store do
expect do
post :update,
- user: { password: 'hello12345', password_confirmation: 'hello12345' }
+ params: { user: { password: 'hello12345', password_confirmation: 'hello12345' } }
end.not_to change { user.reload.encrypted_password }
expect(response.status).to eq(302)
@@ -21,7 +21,7 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update,
- user: { email: "john@gmail.com", name: "John" }
+ params: { user: { email: "john@gmail.com", name: "John" } }
user.reload
@@ -35,7 +35,7 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update,
- user: { email: "john@gmail.com", name: "John" }
+ params: { user: { email: "john@gmail.com", name: "John" } }
user.reload
@@ -52,7 +52,7 @@ describe ProfilesController, :request_store do
sign_in(ldap_user)
put :update,
- user: { email: "john@gmail.com", name: "John" }
+ params: { user: { email: "john@gmail.com", name: "John" } }
ldap_user.reload
@@ -69,7 +69,7 @@ describe ProfilesController, :request_store do
sign_in(ldap_user)
put :update,
- user: { email: "john@gmail.com", name: "John", location: "City, Country" }
+ params: { user: { email: "john@gmail.com", name: "John", location: "City, Country" } }
ldap_user.reload
@@ -82,7 +82,7 @@ describe ProfilesController, :request_store do
it 'allows setting a user status' do
sign_in(user)
- put :update, user: { status: { message: 'Working hard!' } }
+ put :update, params: { user: { status: { message: 'Working hard!' } } }
expect(user.reload.status.message).to eq('Working hard!')
expect(response).to have_gitlab_http_status(302)
@@ -98,7 +98,7 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update_username,
- user: { username: new_username }
+ params: { user: { username: new_username } }
user.reload
@@ -110,7 +110,9 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update_username,
- user: { username: new_username },
+ params: {
+ user: { username: new_username }
+ },
format: :json
expect(response.status).to eq(200)
@@ -121,7 +123,9 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update_username,
- user: { username: 'invalid username.git' },
+ params: {
+ user: { username: 'invalid username.git' }
+ },
format: :json
expect(response.status).to eq(422)
@@ -131,7 +135,7 @@ describe ProfilesController, :request_store do
it 'raises a correct error when the username is missing' do
sign_in(user)
- expect { put :update_username, user: { gandalf: 'you shall not pass' } }
+ expect { put :update_username, params: { user: { gandalf: 'you shall not pass' } } }
.to raise_error(ActionController::ParameterMissing)
end
@@ -142,7 +146,7 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update_username,
- user: { username: new_username }
+ params: { user: { username: new_username } }
user.reload
@@ -160,7 +164,7 @@ describe ProfilesController, :request_store do
sign_in(user)
put :update_username,
- user: { username: new_username }
+ params: { user: { username: new_username } }
user.reload
diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb
index b3c8d6a954e..bd10de45b67 100644
--- a/spec/controllers/projects/artifacts_controller_spec.rb
+++ b/spec/controllers/projects/artifacts_controller_spec.rb
@@ -22,7 +22,7 @@ describe Projects::ArtifactsController do
def download_artifact(extra_params = {})
params = { namespace_id: project.namespace, project_id: project, job_id: job }.merge(extra_params)
- get :download, params
+ get :download, params: params
end
context 'when no file type is supplied' do
@@ -86,7 +86,7 @@ describe Projects::ArtifactsController do
describe 'GET browse' do
context 'when the directory exists' do
it 'renders the browse view' do
- get :browse, namespace_id: project.namespace, project_id: project, job_id: job, path: 'other_artifacts_0.1.2'
+ get :browse, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'other_artifacts_0.1.2' }
expect(response).to render_template('projects/artifacts/browse')
end
@@ -94,7 +94,7 @@ describe Projects::ArtifactsController do
context 'when the directory does not exist' do
it 'responds Not Found' do
- get :browse, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
+ get :browse, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown' }
expect(response).to be_not_found
end
@@ -113,7 +113,7 @@ describe Projects::ArtifactsController do
context 'when the file exists' do
it 'renders the file view' do
- get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt'
+ get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' }
expect(response).to have_gitlab_http_status(302)
end
@@ -121,7 +121,7 @@ describe Projects::ArtifactsController do
context 'when the file does not exist' do
it 'responds Not Found' do
- get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
+ get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown' }
expect(response).to be_not_found
end
@@ -131,7 +131,7 @@ describe Projects::ArtifactsController do
context 'when the file is served through Rails' do
context 'when the file exists' do
it 'renders the file view' do
- get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt'
+ get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('projects/artifacts/file')
@@ -140,7 +140,7 @@ describe Projects::ArtifactsController do
context 'when the file does not exist' do
it 'responds Not Found' do
- get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
+ get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown' }
expect(response).to be_not_found
end
@@ -159,7 +159,7 @@ describe Projects::ArtifactsController do
end
it 'does not redirect the request' do
- get :file, namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt'
+ get :file, params: { namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt' }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template('projects/artifacts/file')
@@ -168,7 +168,7 @@ describe Projects::ArtifactsController do
end
describe 'GET raw' do
- subject { get(:raw, namespace_id: project.namespace, project_id: project, job_id: job, path: path) }
+ subject { get(:raw, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: path }) }
context 'when the file exists' do
let(:path) { 'ci_artifacts.txt' }
@@ -239,7 +239,7 @@ describe Projects::ArtifactsController do
context 'has no such ref' do
before do
- get :latest_succeeded, params_from_ref('TAIL', job.name)
+ get :latest_succeeded, params: params_from_ref('TAIL', job.name)
end
it_behaves_like 'not found'
@@ -247,7 +247,7 @@ describe Projects::ArtifactsController do
context 'has no such job' do
before do
- get :latest_succeeded, params_from_ref(pipeline.ref, 'NOBUILD')
+ get :latest_succeeded, params: params_from_ref(pipeline.ref, 'NOBUILD')
end
it_behaves_like 'not found'
@@ -255,7 +255,7 @@ describe Projects::ArtifactsController do
context 'has no path' do
before do
- get :latest_succeeded, params_from_ref(pipeline.sha, job.name, '')
+ get :latest_succeeded, params: params_from_ref(pipeline.sha, job.name, '')
end
it_behaves_like 'not found'
@@ -276,7 +276,7 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'master',
sha: project.commit('master').sha)
- get :latest_succeeded, params_from_ref('master')
+ get :latest_succeeded, params: params_from_ref('master')
end
it_behaves_like 'redirect to the job'
@@ -287,7 +287,7 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'improve/awesome',
sha: project.commit('improve/awesome').sha)
- get :latest_succeeded, params_from_ref('improve/awesome')
+ get :latest_succeeded, params: params_from_ref('improve/awesome')
end
it_behaves_like 'redirect to the job'
@@ -298,7 +298,7 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'improve/awesome',
sha: project.commit('improve/awesome').sha)
- get :latest_succeeded, params_from_ref('improve/awesome', job.name, 'file/README.md')
+ get :latest_succeeded, params: params_from_ref('improve/awesome', job.name, 'file/README.md')
end
it 'redirects' do
diff --git a/spec/controllers/projects/avatars_controller_spec.rb b/spec/controllers/projects/avatars_controller_spec.rb
index 5a77a7ac06f..40ab81395ea 100644
--- a/spec/controllers/projects/avatars_controller_spec.rb
+++ b/spec/controllers/projects/avatars_controller_spec.rb
@@ -8,7 +8,7 @@ describe Projects::AvatarsController do
end
describe 'GET #show' do
- subject { get :show, namespace_id: project.namespace, project_id: project }
+ subject { get :show, params: { namespace_id: project.namespace, project_id: project } }
context 'when repository has no avatar' do
it 'shows 404' do
@@ -71,7 +71,7 @@ describe Projects::AvatarsController do
describe 'DELETE #destroy' do
it 'removes avatar from DB by calling destroy' do
- delete :destroy, namespace_id: project.namespace.id, project_id: project.id
+ delete :destroy, params: { namespace_id: project.namespace.id, project_id: project.id }
expect(project.avatar.present?).to be_falsey
expect(project).to be_valid
diff --git a/spec/controllers/projects/badges_controller_spec.rb b/spec/controllers/projects/badges_controller_spec.rb
index dfe34171b55..2556bc3ae50 100644
--- a/spec/controllers/projects/badges_controller_spec.rb
+++ b/spec/controllers/projects/badges_controller_spec.rb
@@ -23,6 +23,6 @@ describe Projects::BadgesController do
end
def get_badge(badge)
- get badge, namespace_id: project.namespace.to_param, project_id: project, ref: pipeline.ref, format: :svg
+ get badge, params: { namespace_id: project.namespace.to_param, project_id: project, ref: pipeline.ref }, format: :svg
end
end
diff --git a/spec/controllers/projects/blame_controller_spec.rb b/spec/controllers/projects/blame_controller_spec.rb
index fe4c4863717..eb110ea0002 100644
--- a/spec/controllers/projects/blame_controller_spec.rb
+++ b/spec/controllers/projects/blame_controller_spec.rb
@@ -16,9 +16,11 @@ describe Projects::BlameController do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ })
end
context "valid file" do
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb
index 9fc6af6a045..38957e96798 100644
--- a/spec/controllers/projects/blob_controller_spec.rb
+++ b/spec/controllers/projects/blob_controller_spec.rb
@@ -11,9 +11,11 @@ describe Projects::BlobController do
context 'with file path' do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ })
end
context "valid branch, valid file" do
@@ -48,9 +50,11 @@ describe Projects::BlobController do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ },
format: :json)
end
@@ -66,11 +70,13 @@ describe Projects::BlobController do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id,
- format: :json,
- viewer: 'none')
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id,
+ viewer: 'none'
+ },
+ format: :json)
end
it do
@@ -84,9 +90,11 @@ describe Projects::BlobController do
context 'with tree path' do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ })
controller.instance_variable_set(:@blob, nil)
end
@@ -109,7 +117,7 @@ describe Projects::BlobController do
params = { namespace_id: project.namespace,
project_id: project,
id: 'master/CHANGELOG' }
- get :diff, params.merge(opts)
+ get :diff, params: params.merge(opts)
end
before do
@@ -200,7 +208,7 @@ describe Projects::BlobController do
context 'anonymous' do
before do
- get :edit, default_params
+ get :edit, params: default_params
end
it 'redirects to sign in and returns' do
@@ -213,7 +221,7 @@ describe Projects::BlobController do
before do
sign_in(guest)
- get :edit, default_params
+ get :edit, params: default_params
end
it 'redirects to blob show' do
@@ -227,7 +235,7 @@ describe Projects::BlobController do
before do
project.add_developer(developer)
sign_in(developer)
- get :edit, default_params
+ get :edit, params: default_params
end
it 'redirects to blob show' do
@@ -241,7 +249,7 @@ describe Projects::BlobController do
before do
project.add_maintainer(maintainer)
sign_in(maintainer)
- get :edit, default_params
+ get :edit, params: default_params
end
it 'redirects to blob show' do
@@ -274,7 +282,7 @@ describe Projects::BlobController do
end
it 'redirects to blob' do
- put :update, default_params
+ put :update, params: default_params
expect(response).to redirect_to(blob_after_edit_path)
end
@@ -284,7 +292,7 @@ describe Projects::BlobController do
let(:mr_params) { default_params.merge(from_merge_request_iid: merge_request.iid) }
it 'redirects to MR diff' do
- put :update, mr_params
+ put :update, params: mr_params
after_edit_path = diffs_project_merge_request_path(project, merge_request)
file_anchor = "##{Digest::SHA1.hexdigest('CHANGELOG')}"
@@ -298,7 +306,7 @@ describe Projects::BlobController do
end
it "it redirect to blob" do
- put :update, mr_params
+ put :update, params: mr_params
expect(response).to redirect_to(blob_after_edit_path)
end
@@ -320,7 +328,7 @@ describe Projects::BlobController do
end
it 'redirects to blob' do
- put :update, default_params
+ put :update, params: default_params
expect(response).to redirect_to(project_blob_path(forked_project, 'master/CHANGELOG'))
end
@@ -331,7 +339,7 @@ describe Projects::BlobController do
default_params[:branch_name] = "fork-test-1"
default_params[:create_merge_request] = 1
- put :update, default_params
+ put :update, params: default_params
expect(response).to redirect_to(
project_new_merge_request_path(
@@ -374,7 +382,7 @@ describe Projects::BlobController do
let(:after_delete_path) { project_tree_path(project, 'master/files') }
it 'redirects to the sub directory' do
- delete :destroy, default_params
+ delete :destroy, params: default_params
expect(response).to redirect_to(after_delete_path)
end
@@ -393,7 +401,7 @@ describe Projects::BlobController do
end
it 'redirects to the project root' do
- delete :destroy, default_params
+ delete :destroy, params: default_params
expect(response).to redirect_to(project_root_path)
end
@@ -413,7 +421,7 @@ describe Projects::BlobController do
let(:after_delete_path) { project_tree_path(project, 'binary-encoding') }
it 'redirects to the project root of the branch' do
- delete :destroy, default_params
+ delete :destroy, params: default_params
expect(response).to redirect_to(after_delete_path)
end
diff --git a/spec/controllers/projects/boards_controller_spec.rb b/spec/controllers/projects/boards_controller_spec.rb
index 8d503f6ad32..09199067024 100644
--- a/spec/controllers/projects/boards_controller_spec.rb
+++ b/spec/controllers/projects/boards_controller_spec.rb
@@ -121,8 +121,10 @@ describe Projects::BoardsController do
end
def list_boards(format: :html)
- get :index, namespace_id: project.namespace,
- project_id: project,
+ get :index, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ },
format: format
end
end
@@ -207,9 +209,11 @@ describe Projects::BoardsController do
end
def read_board(board:, format: :html)
- get :show, namespace_id: project.namespace,
- project_id: project,
- id: board.to_param,
+ get :show, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: board.to_param
+ },
format: format
end
end
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb
index 31471cde420..02b3d5269a6 100644
--- a/spec/controllers/projects/branches_controller_spec.rb
+++ b/spec/controllers/projects/branches_controller_spec.rb
@@ -22,10 +22,12 @@ describe Projects::BranchesController do
sign_in(user)
post :create,
- namespace_id: project.namespace,
- project_id: project,
- branch_name: branch,
- ref: ref
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ branch_name: branch,
+ ref: ref
+ }
end
context "valid branch name, valid source" do
@@ -76,10 +78,12 @@ describe Projects::BranchesController do
it 'redirects' do
post :create,
- namespace_id: project.namespace,
- project_id: project,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
expect(subject)
.to redirect_to("/#{project.full_path}/tree/1-feature-branch")
@@ -89,10 +93,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch")
post :create,
- namespace_id: project.namespace,
- project_id: project,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
end
context 'repository-less project' do
@@ -105,10 +111,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create,
- namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
expect(response).to redirect_to project_tree_path(project, branch)
end
@@ -121,10 +129,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create,
- namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
expect(response.location).to include(project_new_blob_path(project, branch))
expect(response).to have_gitlab_http_status(302)
@@ -156,10 +166,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create,
- namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
expect(response.location).to include(project_new_blob_path(project, branch))
expect(response).to have_gitlab_http_status(302)
@@ -173,10 +185,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).not_to receive(:new_issue_branch)
post :create,
- namespace_id: project.namespace,
- project_id: project,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
end
end
@@ -191,10 +205,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).not_to receive(:new_issue_branch)
post :create,
- namespace_id: project.namespace,
- project_id: project,
- branch_name: branch,
- issue_iid: issue.iid
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ branch_name: branch,
+ issue_iid: issue.iid
+ }
end
end
end
@@ -228,11 +244,14 @@ describe Projects::BranchesController do
end
def create_branch(name:, ref:)
- post :create, namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- branch_name: name,
- ref: ref,
- format: :json
+ post :create,
+ format: :json,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ branch_name: name,
+ ref: ref
+ }
end
end
@@ -246,9 +265,11 @@ describe Projects::BranchesController do
it 'returns 303' do
post :destroy,
format: :html,
- id: 'foo/bar/baz',
- namespace_id: project.namespace,
- project_id: project
+ params: {
+ id: 'foo/bar/baz',
+ namespace_id: project.namespace,
+ project_id: project
+ }
expect(response).to have_gitlab_http_status(303)
end
@@ -261,10 +282,12 @@ describe Projects::BranchesController do
sign_in(user)
post :destroy,
- format: format,
- id: branch,
- namespace_id: project.namespace,
- project_id: project
+ format: format,
+ params: {
+ id: branch,
+ namespace_id: project.namespace,
+ project_id: project
+ }
end
context 'as JS' do
@@ -359,8 +382,10 @@ describe Projects::BranchesController do
describe "DELETE destroy_all_merged" do
def destroy_all_merged
delete :destroy_all_merged,
- namespace_id: project.namespace,
- project_id: project
+ params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
end
context 'when user is allowed to push' do
@@ -404,10 +429,12 @@ describe Projects::BranchesController do
context 'when rendering a JSON format' do
it 'filters branches by name' do
get :index,
- namespace_id: project.namespace,
- project_id: project,
format: :json,
- search: 'master'
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ search: 'master'
+ }
parsed_response = JSON.parse(response.body)
@@ -423,10 +450,12 @@ describe Projects::BranchesController do
context 'when cache is enabled yet cold', :request_store do
it 'return with a status 200' do
get :index,
- namespace_id: project.namespace,
- project_id: project,
- state: 'all',
- format: :html
+ format: :html,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ state: 'all'
+ }
expect(response).to have_gitlab_http_status(200)
end
@@ -439,10 +468,12 @@ describe Projects::BranchesController do
it 'return with a status 200' do
get :index,
- namespace_id: project.namespace,
- project_id: project,
- state: 'all',
- format: :html
+ format: :html,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ state: 'all'
+ }
expect(response).to have_gitlab_http_status(200)
end
@@ -451,30 +482,36 @@ describe Projects::BranchesController do
context 'when deprecated sort/search/page parameters are specified' do
it 'returns with a status 301 when sort specified' do
get :index,
- namespace_id: project.namespace,
- project_id: project,
- sort: 'updated_asc',
- format: :html
+ format: :html,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ sort: 'updated_asc'
+ }
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
end
it 'returns with a status 301 when search specified' do
get :index,
- namespace_id: project.namespace,
- project_id: project,
- search: 'feature',
- format: :html
+ format: :html,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ search: 'feature'
+ }
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
end
it 'returns with a status 301 when page specified' do
get :index,
- namespace_id: project.namespace,
- project_id: project,
- page: 2,
- format: :html
+ format: :html,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ page: 2
+ }
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
end
diff --git a/spec/controllers/projects/ci/lints_controller_spec.rb b/spec/controllers/projects/ci/lints_controller_spec.rb
index 1249a5528a9..82c1374aa4f 100644
--- a/spec/controllers/projects/ci/lints_controller_spec.rb
+++ b/spec/controllers/projects/ci/lints_controller_spec.rb
@@ -13,7 +13,7 @@ describe Projects::Ci::LintsController do
before do
project.add_developer(user)
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
end
it 'should be success' do
@@ -33,7 +33,7 @@ describe Projects::Ci::LintsController do
before do
project.add_guest(user)
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
end
it 'should respond with 404' do
@@ -72,7 +72,7 @@ describe Projects::Ci::LintsController do
WebMock.stub_request(:get, remote_file_path).to_return(body: remote_file_content)
project.add_developer(user)
- post :create, namespace_id: project.namespace, project_id: project, content: content
+ post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end
it 'should be success' do
@@ -100,7 +100,7 @@ describe Projects::Ci::LintsController do
before do
project.add_developer(user)
- post :create, namespace_id: project.namespace, project_id: project, content: content
+ post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end
it 'should assign errors' do
@@ -112,7 +112,7 @@ describe Projects::Ci::LintsController do
before do
project.add_guest(user)
- post :create, namespace_id: project.namespace, project_id: project, content: content
+ post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
end
it 'should respond with 404' do
diff --git a/spec/controllers/projects/clusters/applications_controller_spec.rb b/spec/controllers/projects/clusters/applications_controller_spec.rb
index 8106453a775..cb558259225 100644
--- a/spec/controllers/projects/clusters/applications_controller_spec.rb
+++ b/spec/controllers/projects/clusters/applications_controller_spec.rb
@@ -81,7 +81,7 @@ describe Projects::Clusters::ApplicationsController do
end
def go
- post :create, params.merge(namespace_id: project.namespace, project_id: project)
+ post :create, params: params.merge(namespace_id: project.namespace, project_id: project)
end
end
end
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb
index 483222363bb..ea266384446 100644
--- a/spec/controllers/projects/clusters_controller_spec.rb
+++ b/spec/controllers/projects/clusters_controller_spec.rb
@@ -18,7 +18,7 @@ describe Projects::ClustersController do
describe 'GET index' do
def go(params = {})
- get :index, params.reverse_merge(namespace_id: project.namespace.to_param, project_id: project)
+ get :index, params: params.reverse_merge(namespace_id: project.namespace.to_param, project_id: project)
end
describe 'functionality' do
@@ -80,7 +80,7 @@ describe Projects::ClustersController do
describe 'GET new' do
def go
- get :new, namespace_id: project.namespace, project_id: project
+ get :new, params: { namespace_id: project.namespace, project_id: project }
end
describe 'functionality for new cluster' do
@@ -174,7 +174,7 @@ describe Projects::ClustersController do
end
def go
- post :create_gcp, params.merge(namespace_id: project.namespace, project_id: project)
+ post :create_gcp, params: params.merge(namespace_id: project.namespace, project_id: project)
end
describe 'functionality' do
@@ -261,7 +261,7 @@ describe Projects::ClustersController do
end
def go
- post :create_user, params.merge(namespace_id: project.namespace, project_id: project)
+ post :create_user, params: params.merge(namespace_id: project.namespace, project_id: project)
end
describe 'functionality' do
@@ -331,9 +331,11 @@ describe Projects::ClustersController do
def go
get :cluster_status,
- namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- id: cluster,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: cluster
+ },
format: :json
end
@@ -369,9 +371,11 @@ describe Projects::ClustersController do
def go
get :show,
- namespace_id: project.namespace,
- project_id: project,
- id: cluster
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: cluster
+ }
end
describe 'functionality' do
@@ -397,11 +401,11 @@ describe Projects::ClustersController do
describe 'PUT update' do
def go(format: :html)
- put :update, params.merge(namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- id: cluster,
- format: format
- )
+ put :update, params: params.merge(namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: cluster,
+ format: format
+ )
end
before do
@@ -500,9 +504,11 @@ describe Projects::ClustersController do
def go
delete :destroy,
- namespace_id: project.namespace,
- project_id: project,
- id: cluster
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: cluster
+ }
end
describe 'functionality' do
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb
index e34fdee62d6..26eec90da06 100644
--- a/spec/controllers/projects/commit_controller_spec.rb
+++ b/spec/controllers/projects/commit_controller_spec.rb
@@ -21,7 +21,7 @@ describe Projects::CommitController do
project_id: project
}
- get :show, params.merge(extra_params)
+ get :show, params: params.merge(extra_params)
end
context 'with valid id' do
@@ -102,9 +102,11 @@ describe Projects::CommitController do
it 'renders it' do
get(:show,
- namespace_id: fork_project.namespace,
- project_id: fork_project,
- id: commit.id)
+ params: {
+ namespace_id: fork_project.namespace,
+ project_id: fork_project,
+ id: commit.id
+ })
expect(response).to be_success
end
@@ -132,9 +134,11 @@ describe Projects::CommitController do
commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e')
get(:branches,
- namespace_id: project.namespace,
- project_id: project,
- id: commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: commit.id
+ })
expect(assigns(:branches)).to include('master', 'feature_conflict')
expect(assigns(:branches_limit_exceeded)).to be_falsey
@@ -148,9 +152,11 @@ describe Projects::CommitController do
allow_any_instance_of(Repository).to receive(:tag_count).and_return(1001)
get(:branches,
- namespace_id: project.namespace,
- project_id: project,
- id: commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: commit.id
+ })
expect(assigns(:branches)).to eq([])
expect(assigns(:branches_limit_exceeded)).to be_truthy
@@ -163,9 +169,11 @@ describe Projects::CommitController do
context 'when target branch is not provided' do
it 'renders the 404 page' do
post(:revert,
- namespace_id: project.namespace,
- project_id: project,
- id: commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: commit.id
+ })
expect(response).not_to be_success
expect(response).to have_gitlab_http_status(404)
@@ -175,10 +183,12 @@ describe Projects::CommitController do
context 'when the revert was successful' do
it 'redirects to the commits page' do
post(:revert,
- namespace_id: project.namespace,
- project_id: project,
- start_branch: 'master',
- id: commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ start_branch: 'master',
+ id: commit.id
+ })
expect(response).to redirect_to project_commits_path(project, 'master')
expect(flash[:notice]).to eq('The commit has been successfully reverted.')
@@ -188,19 +198,23 @@ describe Projects::CommitController do
context 'when the revert failed' do
before do
post(:revert,
- namespace_id: project.namespace,
- project_id: project,
- start_branch: 'master',
- id: commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ start_branch: 'master',
+ id: commit.id
+ })
end
it 'redirects to the commit page' do
# Reverting a commit that has been already reverted.
post(:revert,
- namespace_id: project.namespace,
- project_id: project,
- start_branch: 'master',
- id: commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ start_branch: 'master',
+ id: commit.id
+ })
expect(response).to redirect_to project_commit_path(project, commit.id)
expect(flash[:alert]).to match('Sorry, we cannot revert this commit automatically.')
@@ -212,9 +226,11 @@ describe Projects::CommitController do
context 'when target branch is not provided' do
it 'renders the 404 page' do
post(:cherry_pick,
- namespace_id: project.namespace,
- project_id: project,
- id: master_pickable_commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: master_pickable_commit.id
+ })
expect(response).not_to be_success
expect(response).to have_gitlab_http_status(404)
@@ -224,10 +240,12 @@ describe Projects::CommitController do
context 'when the cherry-pick was successful' do
it 'redirects to the commits page' do
post(:cherry_pick,
- namespace_id: project.namespace,
- project_id: project,
- start_branch: 'master',
- id: master_pickable_commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ start_branch: 'master',
+ id: master_pickable_commit.id
+ })
expect(response).to redirect_to project_commits_path(project, 'master')
expect(flash[:notice]).to eq('The commit has been successfully cherry-picked into master.')
@@ -237,19 +255,23 @@ describe Projects::CommitController do
context 'when the cherry_pick failed' do
before do
post(:cherry_pick,
- namespace_id: project.namespace,
- project_id: project,
- start_branch: 'master',
- id: master_pickable_commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ start_branch: 'master',
+ id: master_pickable_commit.id
+ })
end
it 'redirects to the commit page' do
# Cherry-picking a commit that has been already cherry-picked.
post(:cherry_pick,
- namespace_id: project.namespace,
- project_id: project,
- start_branch: 'master',
- id: master_pickable_commit.id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ start_branch: 'master',
+ id: master_pickable_commit.id
+ })
expect(response).to redirect_to project_commit_path(project, master_pickable_commit.id)
expect(flash[:alert]).to match('Sorry, we cannot cherry-pick this commit automatically.')
@@ -264,7 +286,7 @@ describe Projects::CommitController do
project_id: project
}
- get :diff_for_path, params.merge(extra_params)
+ get :diff_for_path, params: params.merge(extra_params)
end
let(:existing_path) { '.gitmodules' }
@@ -332,7 +354,7 @@ describe Projects::CommitController do
project_id: project
}
- get :pipelines, params.merge(extra_params)
+ get :pipelines, params: params.merge(extra_params)
end
context 'when the commit exists' do
diff --git a/spec/controllers/projects/commits_controller_spec.rb b/spec/controllers/projects/commits_controller_spec.rb
index 80513650636..8cb9130b834 100644
--- a/spec/controllers/projects/commits_controller_spec.rb
+++ b/spec/controllers/projects/commits_controller_spec.rb
@@ -17,8 +17,10 @@ describe Projects::CommitsController do
context "no ref is provided" do
it 'should redirect to the default branch of the project' do
get(:commits_root,
- namespace_id: project.namespace,
- project_id: project)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project
+ })
expect(response).to redirect_to project_commits_path(project)
end
@@ -31,9 +33,11 @@ describe Projects::CommitsController do
context 'with file path' do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ })
end
context "valid branch, valid file" do
@@ -65,9 +69,11 @@ describe Projects::CommitsController do
context "when the ref does not exist with the suffix" do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: "master.atom")
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: "master.atom"
+ })
end
it "renders as atom" do
@@ -88,9 +94,11 @@ describe Projects::CommitsController do
allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit)
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: "master.atom")
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: "master.atom"
+ })
end
it "renders as HTML" do
@@ -106,9 +114,11 @@ describe Projects::CommitsController do
before do
get(:signatures,
- namespace_id: project.namespace,
- project_id: project,
- id: id,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ },
format: :json)
end
diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb
index 17883d0fadd..cfd70e93efb 100644
--- a/spec/controllers/projects/compare_controller_spec.rb
+++ b/spec/controllers/projects/compare_controller_spec.rb
@@ -13,7 +13,7 @@ describe Projects::CompareController do
render_views
before do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
end
it 'returns successfully' do
@@ -24,7 +24,7 @@ describe Projects::CompareController do
describe 'GET show' do
render_views
- subject(:show_request) { get :show, request_params }
+ subject(:show_request) { get :show, params: request_params }
let(:request_params) do
{
@@ -130,7 +130,7 @@ describe Projects::CompareController do
project_id: project
}
- get :diff_for_path, params.merge(extra_params)
+ get :diff_for_path, params: params.merge(extra_params)
end
let(:existing_path) { 'files/ruby/feature.rb' }
@@ -201,7 +201,7 @@ describe Projects::CompareController do
end
describe 'POST create' do
- subject(:create_request) { post :create, request_params }
+ subject(:create_request) { post :create, params: request_params }
let(:request_params) do
{
@@ -260,7 +260,7 @@ describe Projects::CompareController do
end
describe 'GET signatures' do
- subject(:signatures_request) { get :signatures, request_params }
+ subject(:signatures_request) { get :signatures, params: request_params }
let(:request_params) do
{
diff --git a/spec/controllers/projects/cycle_analytics_controller_spec.rb b/spec/controllers/projects/cycle_analytics_controller_spec.rb
index 5c79269e8f1..6a63cbdf8e2 100644
--- a/spec/controllers/projects/cycle_analytics_controller_spec.rb
+++ b/spec/controllers/projects/cycle_analytics_controller_spec.rb
@@ -13,8 +13,10 @@ describe Projects::CycleAnalyticsController do
context 'with no data' do
it 'is true' do
get(:show,
- namespace_id: project.namespace,
- project_id: project)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project
+ })
expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(true)
@@ -32,8 +34,10 @@ describe Projects::CycleAnalyticsController do
it 'is false' do
get(:show,
- namespace_id: project.namespace,
- project_id: project)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project
+ })
expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(false)
diff --git a/spec/controllers/projects/deploy_keys_controller_spec.rb b/spec/controllers/projects/deploy_keys_controller_spec.rb
index 4567a51b88e..a927d4329ef 100644
--- a/spec/controllers/projects/deploy_keys_controller_spec.rb
+++ b/spec/controllers/projects/deploy_keys_controller_spec.rb
@@ -17,7 +17,7 @@ describe Projects::DeployKeysController do
context 'when html requested' do
it 'redirects to blob' do
- get :index, params
+ get :index, params: params
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
end
@@ -48,7 +48,7 @@ describe Projects::DeployKeysController do
end
it 'returns json in a correct format' do
- get :index, params.merge(format: :json)
+ get :index, params: params.merge(format: :json)
json = JSON.parse(response.body)
@@ -74,7 +74,7 @@ describe Projects::DeployKeysController do
it 'redirects to login' do
expect do
- put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(302)
@@ -89,7 +89,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do
expect do
- put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(404)
@@ -103,7 +103,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do
expect do
- put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.to change { DeployKeysProject.count }.by(1)
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
@@ -112,7 +112,7 @@ describe Projects::DeployKeysController do
end
it 'returns 404' do
- put :enable, id: 0, namespace_id: project.namespace, project_id: project
+ put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404)
end
@@ -125,7 +125,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do
expect do
- put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.to change { DeployKeysProject.count }.by(1)
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
@@ -145,7 +145,7 @@ describe Projects::DeployKeysController do
end
it 'redirects to login' do
- put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(302)
expect(response).to redirect_to(new_user_session_path)
@@ -159,7 +159,7 @@ describe Projects::DeployKeysController do
end
it 'returns 404' do
- put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404)
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
@@ -168,7 +168,7 @@ describe Projects::DeployKeysController do
context 'with user with permission' do
it 'returns 302' do
- put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(302)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
@@ -177,7 +177,7 @@ describe Projects::DeployKeysController do
end
it 'returns 404' do
- put :disable, id: 0, namespace_id: project.namespace, project_id: project
+ put :disable, params: { id: 0, namespace_id: project.namespace, project_id: project }
expect(response).to have_http_status(404)
end
@@ -190,7 +190,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do
expect do
- put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
+ put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
end.to change { DeployKey.count }.by(-1)
expect(response).to have_http_status(302)
diff --git a/spec/controllers/projects/deployments_controller_spec.rb b/spec/controllers/projects/deployments_controller_spec.rb
index 5b7da81b6a1..5c33098fd31 100644
--- a/spec/controllers/projects/deployments_controller_spec.rb
+++ b/spec/controllers/projects/deployments_controller_spec.rb
@@ -19,7 +19,7 @@ describe Projects::DeploymentsController do
create(:deployment, :success, environment: environment, created_at: 7.hours.ago)
create(:deployment, :success, environment: environment)
- get :index, deployment_params(after: 8.hours.ago)
+ get :index, params: deployment_params(after: 8.hours.ago)
expect(response).to be_ok
@@ -29,7 +29,7 @@ describe Projects::DeploymentsController do
it 'returns a list with deployments information' do
create(:deployment, :success, environment: environment)
- get :index, deployment_params
+ get :index, params: deployment_params
expect(response).to be_ok
expect(response).to match_response_schema('deployments')
@@ -49,7 +49,7 @@ describe Projects::DeploymentsController do
end
it 'responds with not found' do
- get :metrics, deployment_params(id: deployment.id)
+ get :metrics, params: deployment_params(id: deployment.id)
expect(response).to be_not_found
end
@@ -66,7 +66,7 @@ describe Projects::DeploymentsController do
end
it 'returns a empty response 204 resposne' do
- get :metrics, deployment_params(id: deployment.id)
+ get :metrics, params: deployment_params(id: deployment.id)
expect(response).to have_gitlab_http_status(204)
expect(response.body).to eq('')
end
@@ -86,7 +86,7 @@ describe Projects::DeploymentsController do
end
it 'returns a metrics JSON document' do
- get :metrics, deployment_params(id: deployment.id)
+ get :metrics, params: deployment_params(id: deployment.id)
expect(response).to be_ok
expect(json_response['success']).to be(true)
@@ -101,7 +101,7 @@ describe Projects::DeploymentsController do
end
it 'responds with not found' do
- get :metrics, deployment_params(id: deployment.id)
+ get :metrics, params: deployment_params(id: deployment.id)
expect(response).to be_not_found
end
@@ -122,7 +122,7 @@ describe Projects::DeploymentsController do
end
it 'responds with not found' do
- get :metrics, deployment_params(id: deployment.id)
+ get :metrics, params: deployment_params(id: deployment.id)
expect(response).to be_not_found
end
@@ -141,7 +141,7 @@ describe Projects::DeploymentsController do
end
it 'returns a empty response 204 response' do
- get :additional_metrics, deployment_params(id: deployment.id, format: :json)
+ get :additional_metrics, params: deployment_params(id: deployment.id, format: :json)
expect(response).to have_gitlab_http_status(204)
expect(response.body).to eq('')
end
@@ -161,7 +161,7 @@ describe Projects::DeploymentsController do
end
it 'returns a metrics JSON document' do
- get :additional_metrics, deployment_params(id: deployment.id, format: :json)
+ get :additional_metrics, params: deployment_params(id: deployment.id, format: :json)
expect(response).to be_ok
expect(json_response['success']).to be(true)
diff --git a/spec/controllers/projects/discussions_controller_spec.rb b/spec/controllers/projects/discussions_controller_spec.rb
index 4aa33dbbb01..0b9f336cf13 100644
--- a/spec/controllers/projects/discussions_controller_spec.rb
+++ b/spec/controllers/projects/discussions_controller_spec.rb
@@ -23,7 +23,7 @@ describe Projects::DiscussionsController do
context 'when user is not authorized to read the MR' do
it 'returns 404' do
- get :show, request_params, format: :json
+ get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(404)
end
@@ -35,7 +35,7 @@ describe Projects::DiscussionsController do
end
it 'returns status 200' do
- get :show, request_params, format: :json
+ get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(200)
end
@@ -43,7 +43,7 @@ describe Projects::DiscussionsController do
it 'returns status 404 if MR does not exists' do
merge_request.destroy!
- get :show, request_params, format: :json
+ get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(404)
end
@@ -56,7 +56,7 @@ describe Projects::DiscussionsController do
end
it 'returns status 200' do
- get :show, request_params, format: :json
+ get :show, params: request_params, session: { format: :json }
expect(response).to have_gitlab_http_status(200)
end
@@ -70,7 +70,7 @@ describe Projects::DiscussionsController do
context "when the user is not authorized to resolve the discussion" do
it "returns status 404" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -87,7 +87,7 @@ describe Projects::DiscussionsController do
end
it "returns status 404" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -95,7 +95,7 @@ describe Projects::DiscussionsController do
context "when the discussion is resolvable" do
it "resolves the discussion" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(note.reload.discussion.resolved?).to be true
expect(note.reload.discussion.resolved_by).to eq(user)
@@ -104,17 +104,17 @@ describe Projects::DiscussionsController do
it "sends notifications if all discussions are resolved" do
expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request)
- post :resolve, request_params
+ post :resolve, params: request_params
end
it "returns the name of the resolving user" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(JSON.parse(response.body)['resolved_by']['name']).to eq(user.name)
end
it "returns status 200" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(response).to have_gitlab_http_status(200)
end
@@ -123,7 +123,7 @@ describe Projects::DiscussionsController do
expect_any_instance_of(DiscussionSerializer).to receive(:represent)
.with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true })
- post :resolve, request_params
+ post :resolve, params: request_params
end
context 'diff discussion' do
@@ -131,7 +131,7 @@ describe Projects::DiscussionsController do
let(:discussion) { note.discussion }
it "returns truncated diff lines" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(JSON.parse(response.body)['truncated_diff_lines']).to be_present
end
@@ -149,7 +149,7 @@ describe Projects::DiscussionsController do
context "when the user is not authorized to resolve the discussion" do
it "returns status 404" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -166,7 +166,7 @@ describe Projects::DiscussionsController do
end
it "returns status 404" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -174,13 +174,13 @@ describe Projects::DiscussionsController do
context "when the discussion is resolvable" do
it "unresolves the discussion" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(note.reload.discussion.resolved?).to be false
end
it "returns status 200" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(200)
end
@@ -194,7 +194,7 @@ describe Projects::DiscussionsController do
expect_any_instance_of(DiscussionSerializer).to receive(:represent)
.with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true })
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
end
end
end
diff --git a/spec/controllers/projects/environments_controller_spec.rb b/spec/controllers/projects/environments_controller_spec.rb
index 5fa0488014f..94fb85f217c 100644
--- a/spec/controllers/projects/environments_controller_spec.rb
+++ b/spec/controllers/projects/environments_controller_spec.rb
@@ -17,7 +17,7 @@ describe Projects::EnvironmentsController do
describe 'GET index' do
context 'when a request for the HTML is made' do
it 'responds with status code 200' do
- get :index, environment_params
+ get :index, params: environment_params
expect(response).to have_gitlab_http_status(:ok)
end
@@ -26,7 +26,7 @@ describe Projects::EnvironmentsController do
expect_any_instance_of(Gitlab::EtagCaching::Store)
.to receive(:touch).with(project_environments_path(project, format: :json))
- get :index, environment_params
+ get :index, params: environment_params
end
end
@@ -49,7 +49,7 @@ describe Projects::EnvironmentsController do
context 'when requesting available environments scope' do
before do
- get :index, environment_params(format: :json, scope: :available)
+ get :index, params: environment_params(format: :json, scope: :available)
end
it 'responds with a payload describing available environments' do
@@ -73,7 +73,7 @@ describe Projects::EnvironmentsController do
context 'when requesting stopped environments scope' do
before do
- get :index, environment_params(format: :json, scope: :stopped)
+ get :index, params: environment_params(format: :json, scope: :stopped)
end
it 'responds with a payload describing stopped environments' do
@@ -103,9 +103,11 @@ describe Projects::EnvironmentsController do
context 'when using default format' do
it 'responds with HTML' do
- get :folder, namespace_id: project.namespace,
- project_id: project,
- id: 'staging-1.0'
+ get :folder, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: 'staging-1.0'
+ }
expect(response).to be_ok
expect(response).to render_template 'folder'
@@ -114,9 +116,11 @@ describe Projects::EnvironmentsController do
context 'when using JSON format' do
it 'sorts the subfolders lexicographically' do
- get :folder, namespace_id: project.namespace,
- project_id: project,
- id: 'staging-1.0',
+ get :folder, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: 'staging-1.0'
+ },
format: :json
expect(response).to be_ok
@@ -132,7 +136,7 @@ describe Projects::EnvironmentsController do
describe 'GET show' do
context 'with valid id' do
it 'responds with a status code 200' do
- get :show, environment_params
+ get :show, params: environment_params
expect(response).to be_ok
end
@@ -142,7 +146,7 @@ describe Projects::EnvironmentsController do
it 'responds with a status code 404' do
params = environment_params
params[:id] = 12345
- get :show, params
+ get :show, params: params
expect(response).to have_gitlab_http_status(404)
end
@@ -151,7 +155,7 @@ describe Projects::EnvironmentsController do
describe 'GET edit' do
it 'responds with a status code 200' do
- get :edit, environment_params
+ get :edit, params: environment_params
expect(response).to be_ok
end
@@ -160,7 +164,7 @@ describe Projects::EnvironmentsController do
describe 'PATCH #update' do
it 'responds with a 302' do
patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' })
- patch :update, patch_params
+ patch :update, params: patch_params
expect(response).to have_gitlab_http_status(302)
end
@@ -171,7 +175,7 @@ describe Projects::EnvironmentsController do
it 'returns 404' do
allow_any_instance_of(Environment).to receive(:available?) { false }
- patch :stop, environment_params(format: :json)
+ patch :stop, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(404)
end
@@ -184,7 +188,7 @@ describe Projects::EnvironmentsController do
allow_any_instance_of(Environment)
.to receive_messages(available?: true, stop_with_action!: action)
- patch :stop, environment_params(format: :json)
+ patch :stop, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(200)
expect(json_response).to eq(
@@ -198,7 +202,7 @@ describe Projects::EnvironmentsController do
allow_any_instance_of(Environment)
.to receive_messages(available?: true, stop_with_action!: nil)
- patch :stop, environment_params(format: :json)
+ patch :stop, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(200)
expect(json_response).to eq(
@@ -211,7 +215,7 @@ describe Projects::EnvironmentsController do
describe 'GET #terminal' do
context 'with valid id' do
it 'responds with a status code 200' do
- get :terminal, environment_params
+ get :terminal, params: environment_params
expect(response).to have_gitlab_http_status(200)
end
@@ -222,13 +226,13 @@ describe Projects::EnvironmentsController do
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
.to receive(:terminals)
- get :terminal, environment_params
+ get :terminal, params: environment_params
end
end
context 'with invalid id' do
it 'responds with a status code 404' do
- get :terminal, environment_params(id: 666)
+ get :terminal, params: environment_params(id: 666)
expect(response).to have_gitlab_http_status(404)
end
@@ -254,7 +258,7 @@ describe Projects::EnvironmentsController do
.with(:fake_terminal)
.and_return(workhorse: :response)
- get :terminal_websocket_authorize, environment_params
+ get :terminal_websocket_authorize, params: environment_params
expect(response).to have_gitlab_http_status(200)
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
@@ -264,7 +268,7 @@ describe Projects::EnvironmentsController do
context 'and invalid id' do
it 'returns 404' do
- get :terminal_websocket_authorize, environment_params(id: 666)
+ get :terminal_websocket_authorize, params: environment_params(id: 666)
expect(response).to have_gitlab_http_status(404)
end
@@ -275,7 +279,7 @@ describe Projects::EnvironmentsController do
it 'aborts with an exception' do
allow(Gitlab::Workhorse).to receive(:verify_api_request!).and_raise(JWT::DecodeError)
- expect { get :terminal_websocket_authorize, environment_params }.to raise_error(JWT::DecodeError)
+ expect { get :terminal_websocket_authorize, params: environment_params }.to raise_error(JWT::DecodeError)
# controller tests don't set the response status correctly. It's enough
# to check that the action raised an exception
end
@@ -288,13 +292,13 @@ describe Projects::EnvironmentsController do
it 'redirects to environment if it exists' do
environment = create(:environment, name: 'production', project: project)
- get :metrics_redirect, namespace_id: project.namespace, project_id: project
+ get :metrics_redirect, params: { namespace_id: project.namespace, project_id: project }
expect(response).to redirect_to(environment_metrics_path(environment))
end
it 'redirects to empty page if no environment exists' do
- get :metrics_redirect, namespace_id: project.namespace, project_id: project
+ get :metrics_redirect, params: { namespace_id: project.namespace, project_id: project }
expect(response).to be_ok
expect(response).to render_template 'empty'
@@ -312,14 +316,14 @@ describe Projects::EnvironmentsController do
end
it 'returns a metrics page' do
- get :metrics, environment_params
+ get :metrics, params: environment_params
expect(response).to be_ok
end
context 'when requesting metrics as JSON' do
it 'returns a metrics JSON document' do
- get :metrics, environment_params(format: :json)
+ get :metrics, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(204)
expect(json_response).to eq({})
@@ -337,7 +341,7 @@ describe Projects::EnvironmentsController do
end
it 'returns a metrics JSON document' do
- get :metrics, environment_params(format: :json)
+ get :metrics, params: environment_params(format: :json)
expect(response).to be_ok
expect(json_response['success']).to be(true)
@@ -359,7 +363,7 @@ describe Projects::EnvironmentsController do
context 'when requesting metrics as JSON' do
it 'returns a metrics JSON document' do
- get :additional_metrics, environment_params(format: :json)
+ get :additional_metrics, params: environment_params(format: :json)
expect(response).to have_gitlab_http_status(204)
expect(json_response).to eq({})
@@ -379,7 +383,7 @@ describe Projects::EnvironmentsController do
end
it 'returns a metrics JSON document' do
- get :additional_metrics, environment_params(format: :json)
+ get :additional_metrics, params: environment_params(format: :json)
expect(response).to be_ok
expect(json_response['success']).to be(true)
diff --git a/spec/controllers/projects/find_file_controller_spec.rb b/spec/controllers/projects/find_file_controller_spec.rb
index 66fe41108e2..9072d67af07 100644
--- a/spec/controllers/projects/find_file_controller_spec.rb
+++ b/spec/controllers/projects/find_file_controller_spec.rb
@@ -17,9 +17,11 @@ describe Projects::FindFileController do
before do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ })
end
context "valid branch" do
@@ -36,9 +38,11 @@ describe Projects::FindFileController do
describe "GET #list" do
def go(format: 'json')
get :list,
- namespace_id: project.namespace,
- project_id: project,
- id: id,
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: id
+ },
format: format
end
diff --git a/spec/controllers/projects/forks_controller_spec.rb b/spec/controllers/projects/forks_controller_spec.rb
index 945b6142abf..0e1663c8585 100644
--- a/spec/controllers/projects/forks_controller_spec.rb
+++ b/spec/controllers/projects/forks_controller_spec.rb
@@ -13,8 +13,10 @@ describe Projects::ForksController do
describe 'GET index' do
def get_forks
get :index,
- namespace_id: project.namespace,
- project_id: project
+ params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
end
context 'when fork is public' do
@@ -83,8 +85,10 @@ describe Projects::ForksController do
describe 'GET new' do
def get_new
get :new,
- namespace_id: project.namespace,
- project_id: project
+ params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
end
context 'when user is signed in' do
@@ -111,9 +115,11 @@ describe Projects::ForksController do
describe 'POST create' do
def post_create
post :create,
- namespace_id: project.namespace,
- project_id: project,
- namespace_key: user.namespace.id
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ namespace_key: user.namespace.id
+ }
end
context 'when user is signed in' do
diff --git a/spec/controllers/projects/graphs_controller_spec.rb b/spec/controllers/projects/graphs_controller_spec.rb
index da78592a6f6..73fb7307e11 100644
--- a/spec/controllers/projects/graphs_controller_spec.rb
+++ b/spec/controllers/projects/graphs_controller_spec.rb
@@ -11,7 +11,7 @@ describe Projects::GraphsController do
describe 'GET languages' do
it "redirects_to action charts" do
- get(:commits, namespace_id: project.namespace.path, project_id: project.path, id: 'master')
+ get(:commits, params: { namespace_id: project.namespace.path, project_id: project.path, id: 'master' })
expect(response).to redirect_to action: :charts
end
@@ -19,7 +19,7 @@ describe Projects::GraphsController do
describe 'GET commits' do
it "redirects_to action charts" do
- get(:commits, namespace_id: project.namespace.path, project_id: project.path, id: 'master')
+ get(:commits, params: { namespace_id: project.namespace.path, project_id: project.path, id: 'master' })
expect(response).to redirect_to action: :charts
end
diff --git a/spec/controllers/projects/group_links_controller_spec.rb b/spec/controllers/projects/group_links_controller_spec.rb
index 879aff26deb..675eeff8d12 100644
--- a/spec/controllers/projects/group_links_controller_spec.rb
+++ b/spec/controllers/projects/group_links_controller_spec.rb
@@ -14,10 +14,12 @@ describe Projects::GroupLinksController do
describe '#create' do
shared_context 'link project to group' do
before do
- post(:create, namespace_id: project.namespace,
- project_id: project,
- link_group_id: group.id,
- link_group_access: ProjectGroupLink.default_access)
+ post(:create, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ link_group_id: group.id,
+ link_group_access: ProjectGroupLink.default_access
+ })
end
end
@@ -65,10 +67,12 @@ describe Projects::GroupLinksController do
context 'when project group id equal link group id' do
before do
- post(:create, namespace_id: project.namespace,
- project_id: project,
- link_group_id: group2.id,
- link_group_access: ProjectGroupLink.default_access)
+ post(:create, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ link_group_id: group2.id,
+ link_group_access: ProjectGroupLink.default_access
+ })
end
it 'does not share project with selected group' do
@@ -84,9 +88,11 @@ describe Projects::GroupLinksController do
context 'when link group id is not present' do
before do
- post(:create, namespace_id: project.namespace,
- project_id: project,
- link_group_access: ProjectGroupLink.default_access)
+ post(:create, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ link_group_access: ProjectGroupLink.default_access
+ })
end
it 'redirects to project group links page' do
diff --git a/spec/controllers/projects/hooks_controller_spec.rb b/spec/controllers/projects/hooks_controller_spec.rb
index 7d3a8c3d0d3..3037c922b68 100644
--- a/spec/controllers/projects/hooks_controller_spec.rb
+++ b/spec/controllers/projects/hooks_controller_spec.rb
@@ -11,7 +11,7 @@ describe Projects::HooksController do
describe '#index' do
it 'redirects to settings/integrations page' do
- get(:index, namespace_id: project.namespace, project_id: project)
+ get(:index, params: { namespace_id: project.namespace, project_id: project })
expect(response).to redirect_to(
project_settings_integrations_path(project)
@@ -38,7 +38,7 @@ describe Projects::HooksController do
wiki_page_events: true
}
- post :create, namespace_id: project.namespace, project_id: project, hook: hook_params
+ post :create, params: { namespace_id: project.namespace, project_id: project, hook: hook_params }
expect(response).to have_http_status(302)
expect(ProjectHook.all.size).to eq(1)
diff --git a/spec/controllers/projects/imports_controller_spec.rb b/spec/controllers/projects/imports_controller_spec.rb
index cdc63f5aab3..3ebfe4b0918 100644
--- a/spec/controllers/projects/imports_controller_spec.rb
+++ b/spec/controllers/projects/imports_controller_spec.rb
@@ -12,13 +12,13 @@ describe Projects::ImportsController do
describe 'GET #show' do
context 'when repository does not exists' do
it 'renders template' do
- get :show, namespace_id: project.namespace.to_param, project_id: project
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to render_template :show
end
it 'sets flash.now if params is present' do
- get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'Started' }
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'Started' } }
expect(flash.now[:notice]).to eq 'Started'
end
@@ -34,13 +34,13 @@ describe Projects::ImportsController do
end
it 'renders template' do
- get :show, namespace_id: project.namespace.to_param, project_id: project
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to render_template :show
end
it 'sets flash.now if params is present' do
- get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'In progress' }
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'In progress' } }
expect(flash.now[:notice]).to eq 'In progress'
end
@@ -52,7 +52,7 @@ describe Projects::ImportsController do
end
it 'redirects to new_namespace_project_import_path' do
- get :show, namespace_id: project.namespace.to_param, project_id: project
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to redirect_to new_project_import_path(project)
end
@@ -67,7 +67,7 @@ describe Projects::ImportsController do
it 'redirects to namespace_project_path' do
allow_any_instance_of(Project).to receive(:forked?).and_return(true)
- get :show, namespace_id: project.namespace.to_param, project_id: project
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(flash[:notice]).to eq 'The project was successfully forked.'
expect(response).to redirect_to project_path(project)
@@ -76,7 +76,7 @@ describe Projects::ImportsController do
context 'when project is external' do
it 'redirects to namespace_project_path' do
- get :show, namespace_id: project.namespace.to_param, project_id: project
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(flash[:notice]).to eq 'The project was successfully imported.'
expect(response).to redirect_to project_path(project)
@@ -92,7 +92,7 @@ describe Projects::ImportsController do
end
it 'redirects to internal params[:to]' do
- get :show, namespace_id: project.namespace.to_param, project_id: project, continue: params
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: params }
expect(flash[:notice]).to eq params[:notice]
expect(response).to redirect_to params[:to]
@@ -101,7 +101,7 @@ describe Projects::ImportsController do
it 'does not redirect to external params[:to]' do
params[:to] = "//google.com"
- get :show, namespace_id: project.namespace.to_param, project_id: project, continue: params
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: params }
expect(response).not_to redirect_to params[:to]
end
end
@@ -113,7 +113,7 @@ describe Projects::ImportsController do
end
it 'redirects to namespace_project_path' do
- get :show, namespace_id: project.namespace.to_param, project_id: project
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to redirect_to project_path(project)
end
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 6240ab6d867..f9193513a6a 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -18,7 +18,7 @@ describe Projects::IssuesController do
project.issues_enabled = false
project.save!
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404)
end
@@ -26,7 +26,7 @@ describe Projects::IssuesController do
context 'when GitLab issues enabled' do
it 'renders the "index" template' do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:index)
@@ -45,13 +45,13 @@ describe Projects::IssuesController do
it_behaves_like 'set sort order from user preference'
it "returns index" do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
end
it "returns 301 if request path doesn't match project path" do
- get :index, namespace_id: project.namespace, project_id: project.path.upcase
+ get :index, params: { namespace_id: project.namespace, project_id: project.path.upcase }
expect(response).to redirect_to(project_issues_path(project))
end
@@ -60,7 +60,7 @@ describe Projects::IssuesController do
project.issues_enabled = false
project.save!
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404)
end
end
@@ -77,18 +77,22 @@ describe Projects::IssuesController do
it 'redirects to last_page if page number is larger than number of pages' do
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project,
- page: (last_page + 1).to_param
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ page: (last_page + 1).to_param
+ }
expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
end
it 'redirects to specified page' do
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project,
- page: last_page.to_param
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ page: last_page.to_param
+ }
expect(assigns(:issues).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(200)
@@ -97,10 +101,12 @@ describe Projects::IssuesController do
it 'does not redirect to external sites when provided a host field' do
external_host = "www.example.com"
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project,
- page: (last_page + 1).to_param,
- host: external_host
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ page: (last_page + 1).to_param,
+ host: external_host
+ }
expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
end
@@ -109,9 +115,11 @@ describe Projects::IssuesController do
allow(controller).to receive(:pagination_disabled?).and_return(true)
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project,
- page: (last_page + 1).to_param
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ page: (last_page + 1).to_param
+ }
expect(response).to have_gitlab_http_status(200)
expect(assigns(:issues).size).to eq(2)
@@ -121,7 +129,7 @@ describe Projects::IssuesController do
describe 'GET #new' do
it 'redirects to signin if not logged in' do
- get :new, namespace_id: project.namespace, project_id: project
+ get :new, params: { namespace_id: project.namespace, project_id: project }
expect(flash[:notice]).to eq 'Please sign in to create the new issue.'
expect(response).to redirect_to(new_user_session_path)
@@ -134,7 +142,7 @@ describe Projects::IssuesController do
end
it 'builds a new issue' do
- get :new, namespace_id: project.namespace, project_id: project
+ get :new, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:issue)).to be_a_new(Issue)
end
@@ -144,7 +152,7 @@ describe Projects::IssuesController do
project_with_repository.add_developer(user)
mr = create(:merge_request_with_diff_notes, source_project: project_with_repository)
- get :new, namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_to_resolve_discussions_of: mr.iid
+ get :new, params: { namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_to_resolve_discussions_of: mr.iid }
expect(assigns(:issue).title).not_to be_empty
expect(assigns(:issue).description).not_to be_empty
@@ -153,7 +161,7 @@ describe Projects::IssuesController do
it 'fills in an issue for a discussion' do
note = create(:note_on_merge_request, project: project)
- get :new, namespace_id: project.namespace.path, project_id: project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id
+ get :new, params: { namespace_id: project.namespace.path, project_id: project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id }
expect(assigns(:issue).title).not_to be_empty
expect(assigns(:issue).description).not_to be_empty
@@ -178,7 +186,7 @@ describe Projects::IssuesController do
project.issues_enabled = false
project.save!
- get :new, namespace_id: project.namespace, project_id: project
+ get :new, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(404)
end
@@ -186,7 +194,7 @@ describe Projects::IssuesController do
context 'when GitLab issues enabled' do
it 'renders the "new" template' do
- get :new, namespace_id: project.namespace, project_id: project
+ get :new, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:new)
@@ -212,9 +220,11 @@ describe Projects::IssuesController do
context 'without an AJAX request' do
it 'stores the visited URL' do
get :show,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: issue.iid
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: issue.iid
+ }
expect(session['user_return_to']).to eq("/#{project.namespace.to_param}/#{project.to_param}/issues/#{issue.iid}")
end
@@ -253,11 +263,13 @@ describe Projects::IssuesController do
def move_issue
post :move,
- format: :json,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: issue.iid,
- move_to_project_id: another_project.id
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: issue.iid,
+ move_to_project_id: another_project.id
+ },
+ format: :json
end
end
end
@@ -265,10 +277,13 @@ describe Projects::IssuesController do
describe 'PUT #update' do
subject do
put :update,
- namespace_id: project.namespace,
- project_id: project,
- id: issue.to_param,
- issue: { title: 'New title' }, format: :json
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: issue.to_param,
+ issue: { title: 'New title' }
+ },
+ format: :json
end
before do
@@ -318,9 +333,11 @@ describe Projects::IssuesController do
describe 'GET #realtime_changes' do
def go(id:)
get :realtime_changes,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ }
end
context 'when an issue was edited' do
@@ -433,8 +450,10 @@ describe Projects::IssuesController do
def get_issues
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project
+ }
end
end
@@ -502,7 +521,7 @@ describe Projects::IssuesController do
format: :json
}.merge(additional_params)
- put :update, params
+ put :update, params: params
end
def go(id:)
@@ -635,9 +654,11 @@ describe Projects::IssuesController do
def go(id:)
get :show,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ }
end
it 'avoids (most) N+1s loading labels', :request_store do
@@ -658,9 +679,11 @@ describe Projects::IssuesController do
def go(id:)
get :realtime_changes,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ }
end
end
@@ -669,9 +692,11 @@ describe Projects::IssuesController do
def go(id:)
get :edit,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ }
end
end
@@ -680,10 +705,12 @@ describe Projects::IssuesController do
def go(id:)
put :update,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id,
- issue: { title: 'New title' }
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id,
+ issue: { title: 'New title' }
+ }
end
end
end
@@ -694,7 +721,7 @@ describe Projects::IssuesController do
project = create(:project, :public)
project.add_developer(user)
- post :create, {
+ post :create, params: {
namespace_id: project.namespace.to_param,
project_id: project,
issue: { title: 'Title', description: 'Description' }.merge(issue_attrs)
@@ -718,7 +745,7 @@ describe Projects::IssuesController do
end
def post_issue(issue_params, other_params: {})
- post :create, { namespace_id: project.namespace.to_param, project_id: project, issue: issue_params, merge_request_to_resolve_discussions_of: merge_request.iid }.merge(other_params)
+ post :create, params: { namespace_id: project.namespace.to_param, project_id: project, issue: issue_params, merge_request_to_resolve_discussions_of: merge_request.iid }.merge(other_params)
end
it 'creates an issue for the project' do
@@ -885,7 +912,7 @@ describe Projects::IssuesController do
create(:user_agent_detail, subject: issue)
project.add_maintainer(admin)
sign_in(admin)
- post :mark_as_spam, {
+ post :mark_as_spam, params: {
namespace_id: project.namespace,
project_id: project,
id: issue.iid
@@ -906,7 +933,7 @@ describe Projects::IssuesController do
end
it "rejects a developer to destroy an issue" do
- delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
+ delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
expect(response).to have_gitlab_http_status(404)
end
end
@@ -921,7 +948,7 @@ describe Projects::IssuesController do
end
it "deletes the issue" do
- delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
+ delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
expect(response).to have_gitlab_http_status(302)
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./)
@@ -930,7 +957,7 @@ describe Projects::IssuesController do
it 'delegates the update of the todos count cache to TodoService' do
expect_any_instance_of(TodoService).to receive(:destroy_target).with(issue).once
- delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
+ delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
end
end
end
@@ -943,8 +970,12 @@ describe Projects::IssuesController do
it "toggles the award emoji" do
expect do
- post(:toggle_award_emoji, namespace_id: project.namespace,
- project_id: project, id: issue.iid, name: "thumbsup")
+ post(:toggle_award_emoji, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: issue.iid,
+ name: "thumbsup"
+ })
end.to change { issue.award_emoji.count }.by(1)
expect(response).to have_gitlab_http_status(200)
@@ -986,9 +1017,11 @@ describe Projects::IssuesController do
end
def create_merge_request
- post :create_merge_request, namespace_id: project.namespace.to_param,
- project_id: project.to_param,
- id: issue.to_param,
+ post :create_merge_request, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: issue.to_param
+ },
format: :json
end
end
@@ -1002,7 +1035,7 @@ describe Projects::IssuesController do
end
it 'returns discussion json' do
- get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
+ get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
expect(json_response.first.keys).to match_array(%w[id reply_id expanded notes diff_discussion discussion_path individual_note resolvable resolved resolved_at resolved_by resolved_by_push commit_id for_commit project_id])
end
@@ -1010,7 +1043,7 @@ describe Projects::IssuesController do
it 'renders the author status html if there is a status' do
create(:user_status, user: discussion.author)
- get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
+ get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
note_json = json_response.first['notes'].first
@@ -1019,14 +1052,14 @@ describe Projects::IssuesController do
it 'does not cause an extra query for the status' do
control = ActiveRecord::QueryRecorder.new do
- get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
+ get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
end
create(:user_status, user: discussion.author)
second_discussion = create(:discussion_note_on_issue, noteable: issue, project: issue.project, author: create(:user))
create(:user_status, user: second_discussion.author)
- expect { get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid }
+ expect { get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } }
.not_to exceed_query_limit(control)
end
@@ -1046,26 +1079,26 @@ describe Projects::IssuesController do
end
it 'filters notes that the user should not see' do
- get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
+ get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
expect(JSON.parse(response.body).count).to eq(1)
end
it 'does not result in N+1 queries' do
# Instantiate the controller variables to ensure QueryRecorder has an accurate base count
- get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
+ get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
RequestStore.clear!
control_count = ActiveRecord::QueryRecorder.new do
- get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
+ get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
end.count
RequestStore.clear!
create_list(:discussion_note_on_issue, 2, :system, noteable: issue, project: issue.project, note: cross_reference)
- expect { get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid }.not_to exceed_query_limit(control_count)
+ expect { get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } }.not_to exceed_query_limit(control_count)
end
end
end
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb
index fca313dafb1..e1133fdd562 100644
--- a/spec/controllers/projects/jobs_controller_spec.rb
+++ b/spec/controllers/projects/jobs_controller_spec.rb
@@ -96,7 +96,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project
}
- get :index, params.merge(extra_params)
+ get :index, params: params.merge(extra_params)
end
end
@@ -461,7 +461,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project
}
- get :show, params.merge(extra_params)
+ get :show, params: params.merge(extra_params)
end
end
@@ -552,9 +552,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def get_trace
- get :trace, namespace_id: project.namespace,
- project_id: project,
- id: job.id,
+ get :trace, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ },
format: :json
end
end
@@ -564,9 +566,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
let(:status) { job.detailed_status(double('user')) }
before do
- get :status, namespace_id: project.namespace,
- project_id: project,
- id: job.id,
+ get :status, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ },
format: :json
end
@@ -605,9 +609,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def post_retry
- post :retry, namespace_id: project.namespace,
- project_id: project,
- id: job.id
+ post :retry, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ }
end
end
@@ -645,9 +651,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def post_play
- post :play, namespace_id: project.namespace,
- project_id: project,
- id: job.id
+ post :play, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ }
end
end
@@ -714,9 +722,9 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def post_cancel(additional_params = {})
- post :cancel, { namespace_id: project.namespace,
- project_id: project,
- id: job.id }.merge(additional_params)
+ post :cancel, params: { namespace_id: project.namespace,
+ project_id: project,
+ id: job.id }.merge(additional_params)
end
end
@@ -754,9 +762,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def post_unschedule
- post :unschedule, namespace_id: project.namespace,
- project_id: project,
- id: job.id
+ post :unschedule, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ }
end
end
@@ -797,8 +807,10 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def post_cancel_all
- post :cancel_all, namespace_id: project.namespace,
- project_id: project
+ post :cancel_all, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
end
end
@@ -860,17 +872,21 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
def post_erase
- post :erase, namespace_id: project.namespace,
- project_id: project,
- id: job.id
+ post :erase, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ }
end
end
describe 'GET raw' do
subject do
- post :raw, namespace_id: project.namespace,
- project_id: project,
- id: job.id
+ post :raw, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: job.id
+ }
end
context "when job has a trace artifact" do
@@ -1020,7 +1036,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project
}
- get :terminal, params.merge(extra_params)
+ get :terminal, params: params.merge(extra_params)
end
end
@@ -1074,7 +1090,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project
}
- get :terminal_websocket_authorize, params.merge(extra_params)
+ get :terminal_websocket_authorize, params: params.merge(extra_params)
end
end
end
diff --git a/spec/controllers/projects/labels_controller_spec.rb b/spec/controllers/projects/labels_controller_spec.rb
index e03d23bcdf6..32897a0f1b4 100644
--- a/spec/controllers/projects/labels_controller_spec.rb
+++ b/spec/controllers/projects/labels_controller_spec.rb
@@ -67,7 +67,7 @@ describe Projects::LabelsController do
end
def list_labels
- get :index, namespace_id: project.namespace.to_param, project_id: project
+ get :index, params: { namespace_id: project.namespace.to_param, project_id: project }
end
end
@@ -76,7 +76,7 @@ describe Projects::LabelsController do
let(:personal_project) { create(:project, namespace: user.namespace) }
it 'creates labels' do
- post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project
+ post :generate, params: { namespace_id: personal_project.namespace.to_param, project_id: personal_project }
expect(response).to have_gitlab_http_status(302)
end
@@ -84,7 +84,7 @@ describe Projects::LabelsController do
context 'project belonging to a group' do
it 'creates labels' do
- post :generate, namespace_id: project.namespace.to_param, project_id: project
+ post :generate, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to have_gitlab_http_status(302)
end
@@ -109,7 +109,7 @@ describe Projects::LabelsController do
end
def toggle_subscription(label)
- post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project, id: label.to_param
+ post :toggle_subscription, params: { namespace_id: project.namespace.to_param, project_id: project, id: label.to_param }
end
end
@@ -119,7 +119,7 @@ describe Projects::LabelsController do
context 'not group reporters' do
it 'denies access' do
- post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
+ post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
expect(response).to have_gitlab_http_status(404)
end
@@ -131,13 +131,13 @@ describe Projects::LabelsController do
end
it 'gives access' do
- post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
+ post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
expect(response).to redirect_to(namespace_project_labels_path)
end
it 'promotes the label' do
- post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
+ post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
expect(Label.where(id: label_1.id)).to be_empty
expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil
@@ -146,7 +146,7 @@ describe Projects::LabelsController do
it 'renders label name without parsing it as HTML' do
label_1.update!(name: 'CCC&lt;img src=x onerror=alert(document.domain)&gt;')
- post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
+ post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
expect(flash[:notice]).to eq("CCC&lt;img src=x onerror=alert(document.domain)&gt; promoted to <a href=\"#{group_labels_path(project.group)}\"><u>group label</u></a>.")
end
@@ -159,7 +159,7 @@ describe Projects::LabelsController do
end
it 'returns to label list' do
- post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
+ post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
expect(response).to redirect_to(namespace_project_labels_path)
end
end
@@ -176,7 +176,7 @@ describe Projects::LabelsController do
context 'non-show path' do
context 'with exactly matching casing' do
it 'does not redirect' do
- get :index, namespace_id: project.namespace, project_id: project.to_param
+ get :index, params: { namespace_id: project.namespace, project_id: project.to_param }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -184,7 +184,7 @@ describe Projects::LabelsController do
context 'with different casing' do
it 'redirects to the correct casing' do
- get :index, namespace_id: project.namespace, project_id: project.to_param.upcase
+ get :index, params: { namespace_id: project.namespace, project_id: project.to_param.upcase }
expect(response).to redirect_to(project_labels_path(project))
expect(controller).not_to set_flash[:notice]
@@ -197,7 +197,7 @@ describe Projects::LabelsController do
let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') }
it 'redirects to the canonical path' do
- get :index, namespace_id: project.namespace, project_id: project.to_param + 'old'
+ get :index, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }
expect(response).to redirect_to(project_labels_path(project))
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project))
@@ -209,13 +209,13 @@ describe Projects::LabelsController do
context 'for a non-GET request' do
context 'when requesting the canonical path with different casing' do
it 'does not 404' do
- post :generate, namespace_id: project.namespace, project_id: project
+ post :generate, params: { namespace_id: project.namespace, project_id: project }
expect(response).not_to have_gitlab_http_status(404)
end
it 'does not redirect to the correct casing' do
- post :generate, namespace_id: project.namespace, project_id: project
+ post :generate, params: { namespace_id: project.namespace, project_id: project }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -225,7 +225,7 @@ describe Projects::LabelsController do
let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') }
it 'returns not found' do
- post :generate, namespace_id: project.namespace, project_id: project.to_param + 'old'
+ post :generate, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/projects/mattermosts_controller_spec.rb b/spec/controllers/projects/mattermosts_controller_spec.rb
index c2a334a849c..6c8c7cd8f2b 100644
--- a/spec/controllers/projects/mattermosts_controller_spec.rb
+++ b/spec/controllers/projects/mattermosts_controller_spec.rb
@@ -17,8 +17,10 @@ describe Projects::MattermostsController do
it 'accepts the request' do
get(:new,
- namespace_id: project.namespace.to_param,
- project_id: project)
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project
+ })
expect(response).to have_gitlab_http_status(200)
end
@@ -29,9 +31,11 @@ describe Projects::MattermostsController do
subject do
post(:create,
- namespace_id: project.namespace.to_param,
- project_id: project,
- mattermost: mattermost_params)
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ mattermost: mattermost_params
+ })
end
context 'no request can be made to mattermost' do
diff --git a/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb
index 1e1ea9a7144..039f35875d2 100644
--- a/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb
@@ -21,9 +21,11 @@ describe Projects::MergeRequests::ConflictsController do
.and_raise(Gitlab::Git::Conflict::Parser::UnmergeableFile)
get :show,
- namespace_id: merge_request_with_conflicts.project.namespace.to_param,
- project_id: merge_request_with_conflicts.project,
- id: merge_request_with_conflicts.iid,
+ params: {
+ namespace_id: merge_request_with_conflicts.project.namespace.to_param,
+ project_id: merge_request_with_conflicts.project,
+ id: merge_request_with_conflicts.iid
+ },
format: 'json'
end
@@ -39,9 +41,11 @@ describe Projects::MergeRequests::ConflictsController do
context 'with valid conflicts' do
before do
get :show,
- namespace_id: merge_request_with_conflicts.project.namespace.to_param,
- project_id: merge_request_with_conflicts.project,
- id: merge_request_with_conflicts.iid,
+ params: {
+ namespace_id: merge_request_with_conflicts.project.namespace.to_param,
+ project_id: merge_request_with_conflicts.project,
+ id: merge_request_with_conflicts.iid
+ },
format: 'json'
end
@@ -99,11 +103,13 @@ describe Projects::MergeRequests::ConflictsController do
describe 'GET conflict_for_path' do
def conflict_for_path(path)
get :conflict_for_path,
- namespace_id: merge_request_with_conflicts.project.namespace.to_param,
- project_id: merge_request_with_conflicts.project,
- id: merge_request_with_conflicts.iid,
- old_path: path,
- new_path: path,
+ params: {
+ namespace_id: merge_request_with_conflicts.project.namespace.to_param,
+ project_id: merge_request_with_conflicts.project,
+ id: merge_request_with_conflicts.iid,
+ old_path: path,
+ new_path: path
+ },
format: 'json'
end
@@ -160,12 +166,14 @@ describe Projects::MergeRequests::ConflictsController do
def resolve_conflicts(files)
post :resolve_conflicts,
- namespace_id: merge_request_with_conflicts.project.namespace.to_param,
- project_id: merge_request_with_conflicts.project,
- id: merge_request_with_conflicts.iid,
- format: 'json',
- files: files,
- commit_message: 'Commit message'
+ params: {
+ namespace_id: merge_request_with_conflicts.project.namespace.to_param,
+ project_id: merge_request_with_conflicts.project,
+ id: merge_request_with_conflicts.iid,
+ files: files,
+ commit_message: 'Commit message'
+ },
+ format: 'json'
end
context 'with valid params' do
diff --git a/spec/controllers/projects/merge_requests/creations_controller_spec.rb b/spec/controllers/projects/merge_requests/creations_controller_spec.rb
index f8c37c0a676..ac93393ac3a 100644
--- a/spec/controllers/projects/merge_requests/creations_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests/creations_controller_spec.rb
@@ -24,7 +24,7 @@ describe Projects::MergeRequests::CreationsController do
describe 'GET new' do
context 'merge request that removes a submodule' do
it 'renders new merge request widget template' do
- get :new, get_diff_params
+ get :new, params: get_diff_params
expect(response).to be_success
end
@@ -52,7 +52,7 @@ describe Projects::MergeRequests::CreationsController do
end
it 'limits total commits' do
- get :new, large_diff_params
+ get :new, params: large_diff_params
expect(response).to be_success
@@ -66,7 +66,7 @@ describe Projects::MergeRequests::CreationsController do
end
it 'shows total commits' do
- get :new, large_diff_params
+ get :new, params: large_diff_params
expect(response).to be_success
@@ -85,7 +85,7 @@ describe Projects::MergeRequests::CreationsController do
it 'does not assign diffs var' do
allow_any_instance_of(MergeRequest).to receive(:can_be_created).and_return(false)
- get :diffs, get_diff_params.merge(format: 'json')
+ get :diffs, params: get_diff_params.merge(format: 'json')
expect(response).to be_success
expect(assigns[:diffs]).to be_nil
@@ -101,7 +101,7 @@ describe Projects::MergeRequests::CreationsController do
end
it 'renders JSON including serialized pipelines' do
- get :pipelines, get_diff_params.merge(format: 'json')
+ get :pipelines, params: get_diff_params.merge(format: 'json')
expect(response).to be_ok
expect(json_response).to have_key 'pipelines'
@@ -117,7 +117,7 @@ describe Projects::MergeRequests::CreationsController do
format: 'json'
}
- get :diff_for_path, params.merge(extra_params)
+ get :diff_for_path, params: params.merge(extra_params)
end
let(:existing_path) { 'files/ruby/feature.rb' }
@@ -184,10 +184,12 @@ describe Projects::MergeRequests::CreationsController do
expect(Ability).to receive(:allowed?).with(user, :read_project, project) { true }
get :branch_to,
- namespace_id: fork_project.namespace,
- project_id: fork_project,
- target_project_id: project.id,
- ref: 'master'
+ params: {
+ namespace_id: fork_project.namespace,
+ project_id: fork_project,
+ target_project_id: project.id,
+ ref: 'master'
+ }
expect(assigns(:commit)).not_to be_nil
expect(response).to have_gitlab_http_status(200)
@@ -197,10 +199,12 @@ describe Projects::MergeRequests::CreationsController do
expect(Ability).to receive(:allowed?).with(user, :read_project, project) { false }
get :branch_to,
- namespace_id: fork_project.namespace,
- project_id: fork_project,
- target_project_id: project.id,
- ref: 'master'
+ params: {
+ namespace_id: fork_project.namespace,
+ project_id: fork_project,
+ target_project_id: project.id,
+ ref: 'master'
+ }
expect(assigns(:commit)).to be_nil
expect(response).to have_gitlab_http_status(200)
diff --git a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb
index 8fc5d302af6..a6017d8e5e6 100644
--- a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb
@@ -20,7 +20,7 @@ describe Projects::MergeRequests::DiffsController do
format: 'json'
}
- get :show, params.merge(extra_params)
+ get :show, params: params.merge(extra_params)
end
context 'with default params' do
@@ -89,7 +89,7 @@ describe Projects::MergeRequests::DiffsController do
format: 'json'
}
- get :diff_for_path, params.merge(extra_params)
+ get :diff_for_path, params: params.merge(extra_params)
end
let(:existing_path) { 'files/ruby/popen.rb' }
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index e837c99d19c..962dfb91c9f 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -19,9 +19,11 @@ describe Projects::MergeRequestsController do
describe 'GET commit_change_content' do
it 'renders commit_change_content template' do
get :commit_change_content,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: merge_request.iid,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: merge_request.iid
+ },
format: 'html'
expect(response).to render_template('_commit_change_content')
@@ -31,9 +33,11 @@ describe Projects::MergeRequestsController do
shared_examples "loads labels" do |action|
it "loads labels into the @labels variable" do
get action,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: merge_request.iid,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: merge_request.iid
+ },
format: 'html'
expect(assigns(:labels)).not_to be_nil
end
@@ -47,7 +51,7 @@ describe Projects::MergeRequestsController do
id: merge_request.iid
}
- get :show, params.merge(extra_params)
+ get :show, params: params.merge(extra_params)
end
it_behaves_like "loads labels", :show
@@ -153,9 +157,12 @@ describe Projects::MergeRequestsController do
def get_merge_requests(page = nil)
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project,
- state: 'opened', page: page.to_param
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ state: 'opened',
+ page: page.to_param
+ }
end
it_behaves_like "issuables list meta-data", :merge_request
@@ -182,11 +189,13 @@ describe Projects::MergeRequestsController do
it 'does not redirect to external sites when provided a host field' do
external_host = "www.example.com"
get :index,
- namespace_id: project.namespace.to_param,
- project_id: project,
- state: 'opened',
- page: (last_page + 1).to_param,
- host: external_host
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ state: 'opened',
+ page: (last_page + 1).to_param,
+ host: external_host
+ }
expect(response).to redirect_to(namespace_project_merge_requests_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
end
@@ -227,7 +236,7 @@ describe Projects::MergeRequestsController do
merge_request: mr_params
}.merge(additional_params)
- put :update, params
+ put :update, params: params
end
context 'changing the assignee' do
@@ -324,7 +333,7 @@ describe Projects::MergeRequestsController do
before do
project.add_reporter(user)
- xhr :post, :merge, base_params
+ xhr :post, :merge, params: base_params
end
it 'returns 404' do
@@ -336,7 +345,7 @@ describe Projects::MergeRequestsController do
before do
merge_request.update(title: "WIP: #{merge_request.title}")
- post :merge, base_params
+ post :merge, params: base_params
end
it 'returns :failed' do
@@ -346,7 +355,7 @@ describe Projects::MergeRequestsController do
context 'when the sha parameter does not match the source SHA' do
before do
- post :merge, base_params.merge(sha: 'foo')
+ post :merge, params: base_params.merge(sha: 'foo')
end
it 'returns :sha_mismatch' do
@@ -396,7 +405,7 @@ describe Projects::MergeRequestsController do
end
def merge_when_pipeline_succeeds
- post :merge, base_params.merge(sha: merge_request.diff_head_sha, merge_when_pipeline_succeeds: '1')
+ post :merge, params: base_params.merge(sha: merge_request.diff_head_sha, merge_when_pipeline_succeeds: '1')
end
it 'returns :merge_when_pipeline_succeeds' do
@@ -513,7 +522,7 @@ describe Projects::MergeRequestsController do
let(:user) { create(:user) }
it "denies access to users unless they're admin or project owner" do
- delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
+ delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
expect(response).to have_gitlab_http_status(404)
end
@@ -528,7 +537,7 @@ describe Projects::MergeRequestsController do
end
it "deletes the merge request" do
- delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
+ delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
expect(response).to have_gitlab_http_status(302)
expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./)
@@ -537,7 +546,7 @@ describe Projects::MergeRequestsController do
it 'delegates the update of the todos count cache to TodoService' do
expect_any_instance_of(TodoService).to receive(:destroy_target).with(merge_request).once
- delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
+ delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
end
end
end
@@ -545,9 +554,11 @@ describe Projects::MergeRequestsController do
describe 'GET commits' do
def go(format: 'html')
get :commits,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: merge_request.iid,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: merge_request.iid
+ },
format: format
end
@@ -566,9 +577,11 @@ describe Projects::MergeRequestsController do
sha: merge_request.diff_head_sha)
get :pipelines,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: merge_request.iid,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: merge_request.iid
+ },
format: :json
end
@@ -582,9 +595,11 @@ describe Projects::MergeRequestsController do
describe 'GET test_reports' do
subject do
get :test_reports,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: merge_request.iid,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: merge_request.iid
+ },
format: :json
end
@@ -667,10 +682,12 @@ describe Projects::MergeRequestsController do
merge_request.save
xhr :post, :remove_wip,
- namespace_id: merge_request.project.namespace.to_param,
- project_id: merge_request.project,
- id: merge_request.iid,
- format: :json
+ format: :json,
+ params: {
+ namespace_id: merge_request.project.namespace.to_param,
+ project_id: merge_request.project,
+ id: merge_request.iid
+ }
end
it 'removes the wip status' do
@@ -685,10 +702,12 @@ describe Projects::MergeRequestsController do
describe 'POST cancel_merge_when_pipeline_succeeds' do
subject do
xhr :post, :cancel_merge_when_pipeline_succeeds,
- namespace_id: merge_request.project.namespace.to_param,
- project_id: merge_request.project,
- id: merge_request.iid,
- format: :json
+ format: :json,
+ params: {
+ namespace_id: merge_request.project.namespace.to_param,
+ project_id: merge_request.project,
+ id: merge_request.iid
+ }
end
it 'calls MergeRequests::MergeWhenPipelineSucceedsService' do
@@ -723,9 +742,11 @@ describe Projects::MergeRequestsController do
target_branch: 'master')
post :assign_related_issues,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: merge_request.iid
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: merge_request.iid
+ }
end
it 'shows a flash message on success' do
@@ -824,7 +845,7 @@ describe Projects::MergeRequestsController do
format: 'json'
}
- get :ci_environments_status, params.merge(extra_params)
+ get :ci_environments_status, params: params.merge(extra_params)
end
end
end
@@ -865,9 +886,11 @@ describe Projects::MergeRequestsController do
end
def get_pipeline_status
- get :pipeline_status, namespace_id: project.namespace,
- project_id: project,
- id: merge_request.iid,
+ get :pipeline_status, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: merge_request.iid
+ },
format: :json
end
end
@@ -876,7 +899,7 @@ describe Projects::MergeRequestsController do
let(:viewer) { user }
def post_rebase
- post :rebase, namespace_id: project.namespace, project_id: project, id: merge_request
+ post :rebase, params: { namespace_id: project.namespace, project_id: project, id: merge_request }
end
def expect_rebase_worker_for(user)
@@ -934,13 +957,13 @@ describe Projects::MergeRequestsController do
describe 'GET edit' do
it 'responds successfully' do
- get :edit, namespace_id: project.namespace, project_id: project, id: merge_request
+ get :edit, params: { namespace_id: project.namespace, project_id: project, id: merge_request }
expect(response).to have_gitlab_http_status(:success)
end
it 'assigns the noteable to make sure autocompletes work' do
- get :edit, namespace_id: project.namespace, project_id: project, id: merge_request
+ get :edit, params: { namespace_id: project.namespace, project_id: project, id: merge_request }
expect(assigns(:noteable)).not_to be_nil
end
diff --git a/spec/controllers/projects/milestones_controller_spec.rb b/spec/controllers/projects/milestones_controller_spec.rb
index 658aa2a6738..5892024e756 100644
--- a/spec/controllers/projects/milestones_controller_spec.rb
+++ b/spec/controllers/projects/milestones_controller_spec.rb
@@ -22,7 +22,7 @@ describe Projects::MilestonesController do
def view_milestone(options = {})
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
- get :show, params.merge(options)
+ get :show, params: params.merge(options)
end
it 'shows milestone page' do
@@ -43,9 +43,11 @@ describe Projects::MilestonesController do
describe "#index" do
context "as html" do
def render_index(project:, page:)
- get :index, namespace_id: project.namespace.id,
- project_id: project.id,
- page: page
+ get :index, params: {
+ namespace_id: project.namespace.id,
+ project_id: project.id,
+ page: page
+ }
end
it "queries only projects milestones" do
@@ -90,7 +92,7 @@ describe Projects::MilestonesController do
context 'with a single group ancestor' do
before do
project.update(namespace: group)
- get :index, namespace_id: project.namespace.id, project_id: project.id, format: :json
+ get :index, params: { namespace_id: project.namespace.id, project_id: project.id }, format: :json
end
it "queries projects milestones and groups milestones" do
@@ -107,7 +109,7 @@ describe Projects::MilestonesController do
before do
project.update(namespace: subgroup)
- get :index, namespace_id: project.namespace.id, project_id: project.id, format: :json
+ get :index, params: { namespace_id: project.namespace.id, project_id: project.id }, format: :json
end
it "queries projects milestones and all ancestors milestones" do
@@ -124,7 +126,7 @@ describe Projects::MilestonesController do
it "removes milestone" do
expect(issue.milestone_id).to eq(milestone.id)
- delete :destroy, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :js
+ delete :destroy, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }, format: :js
expect(response).to be_success
expect(Event.recent.first.action).to eq(Event::DESTROYED)
@@ -155,7 +157,7 @@ describe Projects::MilestonesController do
end
it 'renders 404' do
- post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
+ post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
expect(response).to have_gitlab_http_status(404)
end
@@ -167,7 +169,7 @@ describe Projects::MilestonesController do
end
it 'shows group milestone' do
- post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
+ post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
expect(flash[:notice]).to eq("#{milestone.title} promoted to <a href=\"#{group_milestone_path(project.group, milestone.iid)}\"><u>group milestone</u></a>.")
expect(response).to redirect_to(project_milestones_path(project))
@@ -176,7 +178,7 @@ describe Projects::MilestonesController do
it 'renders milestone name without parsing it as HTML' do
milestone.update!(name: 'CCC&lt;img src=x onerror=alert(document.domain)&gt;')
- post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
+ post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
expect(flash[:notice]).to eq("CCC promoted to <a href=\"#{group_milestone_path(project.group, milestone.iid)}\"><u>group milestone</u></a>.")
end
@@ -190,7 +192,7 @@ describe Projects::MilestonesController do
it 'renders 404' do
project.update(namespace: user.namespace)
- post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
+ post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/projects/mirrors_controller_spec.rb b/spec/controllers/projects/mirrors_controller_spec.rb
index 976f480930c..86a12a5e903 100644
--- a/spec/controllers/projects/mirrors_controller_spec.rb
+++ b/spec/controllers/projects/mirrors_controller_spec.rb
@@ -147,7 +147,7 @@ describe Projects::MirrorsController do
end
def do_get(project, url = 'ssh://example.com')
- get :ssh_host_keys, namespace_id: project.namespace, project_id: project, ssh_url: url
+ get :ssh_host_keys, params: { namespace_id: project.namespace, project_id: project, ssh_url: url }
end
end
@@ -155,6 +155,6 @@ describe Projects::MirrorsController do
attrs = extra_attrs.merge(namespace_id: project.namespace.to_param, project_id: project.to_param)
attrs[:project] = options
- put :update, attrs
+ put :update, params: attrs
end
end
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index 9a5df2aded7..81892575889 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -44,7 +44,7 @@ describe Projects::NotesController do
.with(anything, anything, hash_including(last_fetched_at: last_fetched_at))
.and_call_original
- get :index, request_params
+ get :index, params: request_params
end
context 'when user notes_filter is present' do
@@ -55,7 +55,7 @@ describe Projects::NotesController do
it 'filters system notes by comments' do
user.set_notes_filter(UserPreference::NOTES_FILTERS[:only_comments], issue)
- get :index, request_params
+ get :index, params: request_params
expect(notes_json.count).to eq(1)
expect(notes_json.first[:id].to_i).to eq(comment.id)
@@ -64,7 +64,7 @@ describe Projects::NotesController do
it 'returns all notes' do
user.set_notes_filter(UserPreference::NOTES_FILTERS[:all_notes], issue)
- get :index, request_params
+ get :index, params: request_params
expect(notes_json.map { |note| note[:id].to_i }).to contain_exactly(comment.id, system_note.id)
end
@@ -74,7 +74,7 @@ describe Projects::NotesController do
expect(ResourceEvents::MergeIntoNotesService).not_to receive(:new)
- get :index, request_params
+ get :index, params: request_params
end
end
@@ -85,7 +85,7 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id, html: true) }
it 'responds with the expected attributes' do
- get :index, params
+ get :index, params: params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:discussion_html]).not_to be_nil
@@ -101,7 +101,7 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id, html: true) }
it 'responds with the expected attributes' do
- get :index, params
+ get :index, params: params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:discussion_html]).not_to be_nil
@@ -120,7 +120,7 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'merge_request', target_id: merge_request.id, html: true) }
it 'responds with the expected attributes' do
- get :index, params
+ get :index, params: params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:discussion_html]).not_to be_nil
@@ -133,7 +133,7 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'commit', target_id: note.commit_id, html: true) }
it 'responds with the expected attributes' do
- get :index, params
+ get :index, params: params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:discussion_html]).to be_nil
@@ -148,7 +148,7 @@ describe Projects::NotesController do
end
it 'renders 404' do
- get :index, params
+ get :index, params: params
expect(response).to have_gitlab_http_status(404)
end
@@ -162,7 +162,7 @@ describe Projects::NotesController do
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id, html: true) }
it 'responds with the expected attributes' do
- get :index, params
+ get :index, params: params
expect(note_json[:id]).to eq(note.id)
expect(note_json[:html]).not_to be_nil
@@ -182,7 +182,7 @@ describe Projects::NotesController do
end
it 'filters notes that the user should not see' do
- get :index, request_params
+ get :index, params: request_params
expect(parsed_response[:notes].count).to eq(1)
expect(note_json[:id]).to eq(note.id.to_s)
@@ -190,19 +190,19 @@ describe Projects::NotesController do
it 'does not result in N+1 queries' do
# Instantiate the controller variables to ensure QueryRecorder has an accurate base count
- get :index, request_params
+ get :index, params: request_params
RequestStore.clear!
control_count = ActiveRecord::QueryRecorder.new do
- get :index, request_params
+ get :index, params: request_params
end.count
RequestStore.clear!
create_list(:discussion_note_on_issue, 2, :system, noteable: issue, project: issue.project, note: cross_reference)
- expect { get :index, request_params }.not_to exceed_query_limit(control_count)
+ expect { get :index, params: request_params }.not_to exceed_query_limit(control_count)
end
end
end
@@ -227,19 +227,19 @@ describe Projects::NotesController do
end
it "returns status 302 for html" do
- post :create, request_params
+ post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
end
it "returns status 200 for json" do
- post :create, request_params.merge(format: :json)
+ post :create, params: request_params.merge(format: :json)
expect(response).to have_gitlab_http_status(200)
end
it 'returns discussion JSON when the return_discussion param is set' do
- post :create, request_params.merge(format: :json, return_discussion: 'true')
+ post :create, params: request_params.merge(format: :json, return_discussion: 'true')
expect(response).to have_gitlab_http_status(200)
expect(json_response).to have_key 'discussion'
@@ -260,7 +260,7 @@ describe Projects::NotesController do
end
it "returns status 302 for html" do
- post :create, request_params
+ post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
end
@@ -282,7 +282,7 @@ describe Projects::NotesController do
end
def post_create(extra_params = {})
- post :create, {
+ post :create, params: {
note: { note: 'some other note', noteable_id: merge_request.id },
namespace_id: project.namespace,
project_id: project,
@@ -342,7 +342,7 @@ describe Projects::NotesController do
namespace_id: project.namespace
}
- expect { post :create, request_params }.to change { issue.notes.count }.by(1)
+ expect { post :create, params: request_params }.to change { issue.notes.count }.by(1)
.and change { locked_issue.notes.count }.by(0)
expect(response).to have_gitlab_http_status(302)
end
@@ -357,7 +357,7 @@ describe Projects::NotesController do
context 'when a noteable is not found' do
it 'returns 404 status' do
request_params[:target_id] = 9999
- post :create, request_params.merge(format: :json)
+ post :create, params: request_params.merge(format: :json)
expect(response).to have_gitlab_http_status(404)
end
@@ -365,19 +365,19 @@ describe Projects::NotesController do
context 'when a user is a team member' do
it 'returns 302 status for html' do
- post :create, request_params
+ post :create, params: request_params
expect(response).to have_gitlab_http_status(302)
end
it 'returns 200 status for json' do
- post :create, request_params.merge(format: :json)
+ post :create, params: request_params.merge(format: :json)
expect(response).to have_gitlab_http_status(200)
end
it 'creates a new note' do
- expect { post :create, request_params }.to change { Note.count }.by(1)
+ expect { post :create, params: request_params }.to change { Note.count }.by(1)
end
end
@@ -387,13 +387,13 @@ describe Projects::NotesController do
end
it 'returns 404 status' do
- post :create, request_params
+ post :create, params: request_params
expect(response).to have_gitlab_http_status(404)
end
it 'does not create a new note' do
- expect { post :create, request_params }.not_to change { Note.count }
+ expect { post :create, params: request_params }.not_to change { Note.count }
end
end
end
@@ -419,7 +419,7 @@ describe Projects::NotesController do
end
it "updates the note" do
- expect { put :update, request_params }.to change { note.reload.note }
+ expect { put :update, params: request_params }.to change { note.reload.note }
end
end
context "doesnt update the note" do
@@ -441,7 +441,7 @@ describe Projects::NotesController do
note: "New comment"
}
}
- expect { put :update, request_params }.not_to change { note.reload.note }
+ expect { put :update, params: request_params }.not_to change { note.reload.note }
expect(response).to have_gitlab_http_status(404)
end
end
@@ -464,13 +464,13 @@ describe Projects::NotesController do
end
it "returns status 200 for html" do
- delete :destroy, request_params
+ delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(200)
end
it "deletes the note" do
- expect { delete :destroy, request_params }.to change { Note.count }.from(1).to(0)
+ expect { delete :destroy, params: request_params }.to change { Note.count }.from(1).to(0)
end
end
@@ -481,7 +481,7 @@ describe Projects::NotesController do
end
it "returns status 404" do
- delete :destroy, request_params
+ delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -496,17 +496,17 @@ describe Projects::NotesController do
it "toggles the award emoji" do
expect do
- post(:toggle_award_emoji, request_params.merge(name: "thumbsup"))
+ post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
end.to change { note.award_emoji.count }.by(1)
expect(response).to have_gitlab_http_status(200)
end
it "removes the already awarded emoji" do
- post(:toggle_award_emoji, request_params.merge(name: "thumbsup"))
+ post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
expect do
- post(:toggle_award_emoji, request_params.merge(name: "thumbsup"))
+ post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
end.to change { AwardEmoji.count }.by(-1)
expect(response).to have_gitlab_http_status(200)
@@ -525,7 +525,7 @@ describe Projects::NotesController do
context "when the user is not authorized to resolve the note" do
it "returns status 404" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -542,7 +542,7 @@ describe Projects::NotesController do
end
it "returns status 404" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -550,7 +550,7 @@ describe Projects::NotesController do
context "when the note is resolvable" do
it "resolves the note" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(note.reload.resolved?).to be true
expect(note.reload.resolved_by).to eq(user)
@@ -559,17 +559,17 @@ describe Projects::NotesController do
it "sends notifications if all discussions are resolved" do
expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request)
- post :resolve, request_params
+ post :resolve, params: request_params
end
it "returns the name of the resolving user" do
- post :resolve, request_params.merge(html: true)
+ post :resolve, params: request_params.merge(html: true)
expect(JSON.parse(response.body)["resolved_by"]).to eq(user.name)
end
it "returns status 200" do
- post :resolve, request_params
+ post :resolve, params: request_params
expect(response).to have_gitlab_http_status(200)
end
@@ -586,7 +586,7 @@ describe Projects::NotesController do
context "when the user is not authorized to resolve the note" do
it "returns status 404" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -603,7 +603,7 @@ describe Projects::NotesController do
end
it "returns status 404" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -611,13 +611,13 @@ describe Projects::NotesController do
context "when the note is resolvable" do
it "unresolves the note" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(note.reload.resolved?).to be false
end
it "returns status 200" do
- delete :unresolve, request_params
+ delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(200)
end
diff --git a/spec/controllers/projects/pages_controller_spec.rb b/spec/controllers/projects/pages_controller_spec.rb
index 927b6e0c473..382c1b5d124 100644
--- a/spec/controllers/projects/pages_controller_spec.rb
+++ b/spec/controllers/projects/pages_controller_spec.rb
@@ -19,7 +19,7 @@ describe Projects::PagesController do
describe 'GET show' do
it 'returns 200 status' do
- get :show, request_params
+ get :show, params: request_params
expect(response).to have_gitlab_http_status(200)
end
@@ -29,7 +29,7 @@ describe Projects::PagesController do
let(:project) { create(:project, namespace: group) }
it 'returns a 404 status code' do
- get :show, request_params
+ get :show, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -38,7 +38,7 @@ describe Projects::PagesController do
describe 'DELETE destroy' do
it 'returns 302 status' do
- delete :destroy, request_params
+ delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(302)
end
@@ -51,7 +51,7 @@ describe Projects::PagesController do
describe 'GET show' do
it 'returns 404 status' do
- get :show, request_params
+ get :show, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -59,7 +59,7 @@ describe Projects::PagesController do
describe 'DELETE destroy' do
it 'returns 404 status' do
- delete :destroy, request_params
+ delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -82,13 +82,13 @@ describe Projects::PagesController do
end
it 'returns 302 status' do
- patch :update, request_params
+ patch :update, params: request_params
expect(response).to have_gitlab_http_status(:found)
end
it 'redirects back to the pages settings' do
- patch :update, request_params
+ patch :update, params: request_params
expect(response).to redirect_to(project_pages_path(project))
end
@@ -99,7 +99,7 @@ describe Projects::PagesController do
.with(project, user, ActionController::Parameters.new(request_params[:project]).permit!)
.and_return(update_service)
- patch :update, request_params
+ patch :update, params: request_params
end
end
end
diff --git a/spec/controllers/projects/pages_domains_controller_spec.rb b/spec/controllers/projects/pages_domains_controller_spec.rb
index b9cf3e9b091..8b7f7587701 100644
--- a/spec/controllers/projects/pages_domains_controller_spec.rb
+++ b/spec/controllers/projects/pages_domains_controller_spec.rb
@@ -24,7 +24,7 @@ describe Projects::PagesDomainsController do
describe 'GET show' do
it "displays the 'show' page" do
- get(:show, request_params.merge(id: pages_domain.domain))
+ get(:show, params: request_params.merge(id: pages_domain.domain))
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('show')
@@ -33,7 +33,7 @@ describe Projects::PagesDomainsController do
describe 'GET new' do
it "displays the 'new' page" do
- get(:new, request_params)
+ get(:new, params: request_params)
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('new')
@@ -43,7 +43,7 @@ describe Projects::PagesDomainsController do
describe 'POST create' do
it "creates a new pages domain" do
expect do
- post(:create, request_params.merge(pages_domain: pages_domain_params))
+ post(:create, params: request_params.merge(pages_domain: pages_domain_params))
end.to change { PagesDomain.count }.by(1)
created_domain = PagesDomain.reorder(:id).last
@@ -55,7 +55,7 @@ describe Projects::PagesDomainsController do
describe 'GET edit' do
it "displays the 'edit' page" do
- get(:edit, request_params.merge(id: pages_domain.domain))
+ get(:edit, params: request_params.merge(id: pages_domain.domain))
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('edit')
@@ -81,11 +81,11 @@ describe Projects::PagesDomainsController do
.with(ActionController::Parameters.new(pages_domain_params).permit!)
.and_return(true)
- patch(:update, params)
+ patch(:update, params: params)
end
it 'redirects to the project page' do
- patch(:update, params)
+ patch(:update, params: params)
expect(flash[:notice]).to eq 'Domain was updated'
expect(response).to redirect_to(project_pages_path(project))
@@ -95,7 +95,7 @@ describe Projects::PagesDomainsController do
it 'renders the edit action' do
allow(pages_domain).to receive(:update).and_return(false)
- patch(:update, params)
+ patch(:update, params: params)
expect(response).to render_template('edit')
end
@@ -108,7 +108,7 @@ describe Projects::PagesDomainsController do
.with(hash_not_including(:domain))
.and_return(true)
- patch(:update, params.deep_merge(pages_domain: { domain: 'abc' }))
+ patch(:update, params: params.deep_merge(pages_domain: { domain: 'abc' }))
end
end
end
@@ -127,7 +127,7 @@ describe Projects::PagesDomainsController do
it 'handles verification success' do
expect(stub_service).to receive(:execute).and_return(status: :success)
- post :verify, params
+ post :verify, params: params
expect(response).to redirect_to project_pages_domain_path(project, pages_domain)
expect(flash[:notice]).to eq('Successfully verified domain ownership')
@@ -136,14 +136,14 @@ describe Projects::PagesDomainsController do
it 'handles verification failure' do
expect(stub_service).to receive(:execute).and_return(status: :failed)
- post :verify, params
+ post :verify, params: params
expect(response).to redirect_to project_pages_domain_path(project, pages_domain)
expect(flash[:alert]).to eq('Failed to verify domain ownership')
end
it 'returns a 404 response for an unknown domain' do
- post :verify, request_params.merge(id: 'unknown-domain')
+ post :verify, params: request_params.merge(id: 'unknown-domain')
expect(response).to have_gitlab_http_status(404)
end
@@ -152,7 +152,7 @@ describe Projects::PagesDomainsController do
describe 'DELETE destroy' do
it "deletes the pages domain" do
expect do
- delete(:destroy, request_params.merge(id: pages_domain.domain))
+ delete(:destroy, params: request_params.merge(id: pages_domain.domain))
end.to change { PagesDomain.count }.by(-1)
expect(response).to redirect_to(project_pages_path(project))
@@ -166,7 +166,7 @@ describe Projects::PagesDomainsController do
describe 'GET show' do
it 'returns 404 status' do
- get(:show, request_params.merge(id: pages_domain.domain))
+ get(:show, params: request_params.merge(id: pages_domain.domain))
expect(response).to have_gitlab_http_status(404)
end
@@ -174,7 +174,7 @@ describe Projects::PagesDomainsController do
describe 'GET new' do
it 'returns 404 status' do
- get :new, request_params
+ get :new, params: request_params
expect(response).to have_gitlab_http_status(404)
end
@@ -182,7 +182,7 @@ describe Projects::PagesDomainsController do
describe 'POST create' do
it "returns 404 status" do
- post(:create, request_params.merge(pages_domain: pages_domain_params))
+ post(:create, params: request_params.merge(pages_domain: pages_domain_params))
expect(response).to have_gitlab_http_status(404)
end
@@ -190,7 +190,7 @@ describe Projects::PagesDomainsController do
describe 'DELETE destroy' do
it "deletes the pages domain" do
- delete(:destroy, request_params.merge(id: pages_domain.domain))
+ delete(:destroy, params: request_params.merge(id: pages_domain.domain))
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb
index 08e2c957d69..80506249ea9 100644
--- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb
+++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb
@@ -44,7 +44,7 @@ describe Projects::PipelineSchedulesController do
end
def visit_pipelines_schedules
- get :index, namespace_id: project.namespace.to_param, project_id: project, scope: scope
+ get :index, params: { namespace_id: project.namespace.to_param, project_id: project, scope: scope }
end
end
@@ -57,7 +57,7 @@ describe Projects::PipelineSchedulesController do
end
it 'initializes a pipeline schedule model' do
- get :new, namespace_id: project.namespace.to_param, project_id: project
+ get :new, params: { namespace_id: project.namespace.to_param, project_id: project }
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:schedule)).to be_a_new(Ci::PipelineSchedule)
@@ -131,7 +131,7 @@ describe Projects::PipelineSchedulesController do
end
def go
- post :create, namespace_id: project.namespace.to_param, project_id: project, schedule: schedule
+ post :create, params: { namespace_id: project.namespace.to_param, project_id: project, schedule: schedule }
end
end
@@ -328,7 +328,7 @@ describe Projects::PipelineSchedulesController do
end
it 'loads the pipeline schedule' do
- get :edit, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ get :edit, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:schedule)).to eq(pipeline_schedule)
@@ -348,7 +348,7 @@ describe Projects::PipelineSchedulesController do
end
def go
- get :edit, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ get :edit, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
end
end
@@ -366,7 +366,7 @@ describe Projects::PipelineSchedulesController do
end
def go
- post :take_ownership, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ post :take_ownership, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
end
end
@@ -388,7 +388,7 @@ describe Projects::PipelineSchedulesController do
it 'does not allow pipeline to be executed' do
expect(RunPipelineScheduleWorker).not_to receive(:perform_async)
- post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
expect(response).to have_gitlab_http_status(404)
end
@@ -398,7 +398,7 @@ describe Projects::PipelineSchedulesController do
it 'executes a new pipeline' do
expect(RunPipelineScheduleWorker).to receive(:perform_async).with(pipeline_schedule.id, user.id).and_return('job-123')
- post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
expect(flash[:notice]).to start_with 'Successfully scheduled a pipeline to run'
expect(response).to have_gitlab_http_status(302)
@@ -406,7 +406,7 @@ describe Projects::PipelineSchedulesController do
it 'prevents users from scheduling the same pipeline repeatedly' do
2.times do
- post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
end
expect(flash.to_a.size).to eq(2)
@@ -422,7 +422,7 @@ describe Projects::PipelineSchedulesController do
expect(RunPipelineScheduleWorker).not_to receive(:perform_async)
- post :play, namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id
+ post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id }
expect(response).to have_gitlab_http_status(404)
end
@@ -437,7 +437,7 @@ describe Projects::PipelineSchedulesController do
project.add_developer(user)
sign_in(user)
- delete :destroy, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
end
it 'does not delete the pipeline schedule' do
@@ -453,7 +453,7 @@ describe Projects::PipelineSchedulesController do
it 'destroys the pipeline schedule' do
expect do
- delete :destroy, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
+ delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
end.to change { project.pipeline_schedules.count }.by(-1)
expect(response).to have_gitlab_http_status(302)
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index 5c7415a318d..0bb3ef76a3b 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -119,8 +119,10 @@ describe Projects::PipelinesController do
end
def get_pipelines_index_json
- get :index, namespace_id: project.namespace,
- project_id: project,
+ get :index, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ },
format: :json
end
@@ -185,7 +187,7 @@ describe Projects::PipelinesController do
end
def get_pipeline_json
- get :show, namespace_id: project.namespace, project_id: project, id: pipeline, format: :json
+ get :show, params: { namespace_id: project.namespace, project_id: project, id: pipeline }, format: :json
end
def create_build(stage, stage_idx, name)
@@ -240,12 +242,14 @@ describe Projects::PipelinesController do
end
def get_stage(name, params = {})
- get :stage, **params.merge(
- namespace_id: project.namespace,
- project_id: project,
- id: pipeline.id,
- stage: name,
- format: :json)
+ get :stage, params: {
+**params.merge(
+ namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id,
+ stage: name,
+ format: :json)
+}
end
end
@@ -277,10 +281,12 @@ describe Projects::PipelinesController do
end
def get_stage_ajax(name)
- get :stage_ajax, namespace_id: project.namespace,
- project_id: project,
- id: pipeline.id,
- stage: name,
+ get :stage_ajax, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id,
+ stage: name
+ },
format: :json
end
end
@@ -290,9 +296,11 @@ describe Projects::PipelinesController do
let(:status) { pipeline.detailed_status(double('user')) }
before do
- get :status, namespace_id: project.namespace,
- project_id: project,
- id: pipeline.id,
+ get :status, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id
+ },
format: :json
end
@@ -310,9 +318,11 @@ describe Projects::PipelinesController do
let!(:build) { create(:ci_build, :failed, pipeline: pipeline) }
before do
- post :retry, namespace_id: project.namespace,
- project_id: project,
- id: pipeline.id,
+ post :retry, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id
+ },
format: :json
end
@@ -337,9 +347,11 @@ describe Projects::PipelinesController do
let!(:build) { create(:ci_build, :running, pipeline: pipeline) }
before do
- post :cancel, namespace_id: project.namespace,
- project_id: project,
- id: pipeline.id,
+ post :cancel, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id
+ },
format: :json
end
diff --git a/spec/controllers/projects/pipelines_settings_controller_spec.rb b/spec/controllers/projects/pipelines_settings_controller_spec.rb
index b1ba9f74e38..269f105bed2 100644
--- a/spec/controllers/projects/pipelines_settings_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_settings_controller_spec.rb
@@ -13,7 +13,7 @@ describe Projects::PipelinesSettingsController do
describe 'GET show' do
it 'redirects with 302 status code' do
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(302)
end
diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb
index 519af10d78c..009f85903b5 100644
--- a/spec/controllers/projects/project_members_controller_spec.rb
+++ b/spec/controllers/projects/project_members_controller_spec.rb
@@ -6,7 +6,7 @@ describe Projects::ProjectMembersController do
describe 'GET index' do
it 'should have the project_members address with a 200 status code' do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
end
@@ -25,10 +25,12 @@ describe Projects::ProjectMembersController do
end
it 'returns 404' do
- post :create, namespace_id: project.namespace,
- project_id: project,
- user_ids: project_user.id,
- access_level: Gitlab::Access::GUEST
+ post :create, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ user_ids: project_user.id,
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to have_gitlab_http_status(404)
expect(project.users).not_to include project_user
@@ -43,10 +45,12 @@ describe Projects::ProjectMembersController do
it 'adds user to members' do
expect_any_instance_of(Members::CreateService).to receive(:execute).and_return(status: :success)
- post :create, namespace_id: project.namespace,
- project_id: project,
- user_ids: project_user.id,
- access_level: Gitlab::Access::GUEST
+ post :create, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ user_ids: project_user.id,
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(project_project_members_path(project))
@@ -55,10 +59,12 @@ describe Projects::ProjectMembersController do
it 'adds no user to members' do
expect_any_instance_of(Members::CreateService).to receive(:execute).and_return(status: :failure, message: 'Message')
- post :create, namespace_id: project.namespace,
- project_id: project,
- user_ids: '',
- access_level: Gitlab::Access::GUEST
+ post :create, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ user_ids: '',
+ access_level: Gitlab::Access::GUEST
+ }
expect(response).to set_flash.to 'Message'
expect(response).to redirect_to(project_project_members_path(project))
@@ -95,9 +101,11 @@ describe Projects::ProjectMembersController do
context 'when member is not found' do
it 'returns 404' do
- delete :destroy, namespace_id: project.namespace,
- project_id: project,
- id: 42
+ delete :destroy, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: 42
+ }
expect(response).to have_gitlab_http_status(404)
end
@@ -110,9 +118,11 @@ describe Projects::ProjectMembersController do
end
it 'returns 404' do
- delete :destroy, namespace_id: project.namespace,
- project_id: project,
- id: member
+ delete :destroy, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: member
+ }
expect(response).to have_gitlab_http_status(404)
expect(project.members).to include member
@@ -125,9 +135,11 @@ describe Projects::ProjectMembersController do
end
it '[HTML] removes user from members' do
- delete :destroy, namespace_id: project.namespace,
- project_id: project,
- id: member
+ delete :destroy, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: member
+ }
expect(response).to redirect_to(
project_project_members_path(project)
@@ -154,8 +166,10 @@ describe Projects::ProjectMembersController do
context 'when member is not found' do
it 'returns 404' do
- delete :leave, namespace_id: project.namespace,
- project_id: project
+ delete :leave, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
expect(response).to have_gitlab_http_status(404)
end
@@ -168,8 +182,10 @@ describe Projects::ProjectMembersController do
end
it 'removes user from members' do
- delete :leave, namespace_id: project.namespace,
- project_id: project
+ delete :leave, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
expect(response).to set_flash.to "You left the \"#{project.human_name}\" project."
expect(response).to redirect_to(dashboard_projects_path)
@@ -185,8 +201,10 @@ describe Projects::ProjectMembersController do
end
it 'cannot remove themselves from the project' do
- delete :leave, namespace_id: project.namespace,
- project_id: project
+ delete :leave, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
expect(response).to have_gitlab_http_status(403)
end
@@ -198,8 +216,10 @@ describe Projects::ProjectMembersController do
end
it 'removes user from members' do
- delete :leave, namespace_id: project.namespace,
- project_id: project
+ delete :leave, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
expect(response).to set_flash.to 'Your access request to the project has been withdrawn.'
expect(response).to redirect_to(project_path(project))
@@ -216,8 +236,10 @@ describe Projects::ProjectMembersController do
end
it 'creates a new ProjectMember that is not a team member' do
- post :request_access, namespace_id: project.namespace,
- project_id: project
+ post :request_access, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ }
expect(response).to set_flash.to 'Your request for access has been queued for review.'
expect(response).to redirect_to(
@@ -237,9 +259,11 @@ describe Projects::ProjectMembersController do
context 'when member is not found' do
it 'returns 404' do
- post :approve_access_request, namespace_id: project.namespace,
- project_id: project,
- id: 42
+ post :approve_access_request, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: 42
+ }
expect(response).to have_gitlab_http_status(404)
end
@@ -252,9 +276,11 @@ describe Projects::ProjectMembersController do
end
it 'returns 404' do
- post :approve_access_request, namespace_id: project.namespace,
- project_id: project,
- id: member
+ post :approve_access_request, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: member
+ }
expect(response).to have_gitlab_http_status(404)
expect(project.members).not_to include member
@@ -267,9 +293,11 @@ describe Projects::ProjectMembersController do
end
it 'adds user to members' do
- post :approve_access_request, namespace_id: project.namespace,
- project_id: project,
- id: member
+ post :approve_access_request, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: member
+ }
expect(response).to redirect_to(
project_project_members_path(project)
@@ -292,9 +320,11 @@ describe Projects::ProjectMembersController do
shared_context 'import applied' do
before do
- post(:apply_import, namespace_id: project.namespace,
- project_id: project,
- source_project_id: another_project.id)
+ post(:apply_import, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ source_project_id: another_project.id
+ })
end
end
@@ -338,10 +368,12 @@ describe Projects::ProjectMembersController do
it 'does not create a member' do
expect do
- post :create, user_ids: stranger.id,
- namespace_id: project.namespace,
- access_level: Member::OWNER,
- project_id: project
+ post :create, params: {
+ user_ids: stranger.id,
+ namespace_id: project.namespace,
+ access_level: Member::OWNER,
+ project_id: project
+ }
end.to change { project.members.count }.by(0)
end
end
@@ -354,10 +386,12 @@ describe Projects::ProjectMembersController do
it 'creates a member' do
expect do
- post :create, user_ids: stranger.id,
- namespace_id: project.namespace,
- access_level: Member::MAINTAINER,
- project_id: project
+ post :create, params: {
+ user_ids: stranger.id,
+ namespace_id: project.namespace,
+ access_level: Member::MAINTAINER,
+ project_id: project
+ }
end.to change { project.members.count }.by(1)
end
end
diff --git a/spec/controllers/projects/prometheus/metrics_controller_spec.rb b/spec/controllers/projects/prometheus/metrics_controller_spec.rb
index 5c56a712245..635763ce1d3 100644
--- a/spec/controllers/projects/prometheus/metrics_controller_spec.rb
+++ b/spec/controllers/projects/prometheus/metrics_controller_spec.rb
@@ -24,7 +24,7 @@ describe Projects::Prometheus::MetricsController do
end
it 'returns no content response' do
- get :active_common, project_params(format: :json)
+ get :active_common, params: project_params(format: :json)
expect(response).to have_gitlab_http_status(204)
end
@@ -38,7 +38,7 @@ describe Projects::Prometheus::MetricsController do
end
it 'returns no content response' do
- get :active_common, project_params(format: :json)
+ get :active_common, params: project_params(format: :json)
expect(response).to have_gitlab_http_status(200)
expect(json_response).to eq(sample_response.deep_stringify_keys)
@@ -47,7 +47,7 @@ describe Projects::Prometheus::MetricsController do
context 'when requesting non json response' do
it 'returns not found response' do
- get :active_common, project_params
+ get :active_common, params: project_params
expect(response).to have_gitlab_http_status(404)
end
@@ -62,7 +62,7 @@ describe Projects::Prometheus::MetricsController do
allow(controller).to receive(:prometheus_adapter).and_return(prometheus_adapter)
allow(prometheus_adapter).to receive(:query).with(:matched_metrics).and_return({})
- get :active_common, project_params(format: :json)
+ get :active_common, params: project_params(format: :json)
expect(response).to have_gitlab_http_status(404)
end
@@ -70,7 +70,7 @@ describe Projects::Prometheus::MetricsController do
context 'when prometheus_adapter is disabled' do
it 'renders 404' do
- get :active_common, project_params(format: :json)
+ get :active_common, params: project_params(format: :json)
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/projects/protected_branches_controller_spec.rb b/spec/controllers/projects/protected_branches_controller_spec.rb
index ac812707e74..483d3bbc37c 100644
--- a/spec/controllers/projects/protected_branches_controller_spec.rb
+++ b/spec/controllers/projects/protected_branches_controller_spec.rb
@@ -15,7 +15,7 @@ describe Projects::ProtectedBranchesController do
let(:project) { create(:project_empty_repo, :public) }
it "redirects empty repo to projects page" do
- get(:index, namespace_id: project.namespace.to_param, project_id: project)
+ get(:index, params: { namespace_id: project.namespace.to_param, project_id: project })
end
end
@@ -33,7 +33,7 @@ describe Projects::ProtectedBranchesController do
it 'creates the protected branch rule' do
expect do
- post(:create, project_params.merge(protected_branch: create_params))
+ post(:create, params: project_params.merge(protected_branch: create_params))
end.to change(ProtectedBranch, :count).by(1)
end
@@ -44,7 +44,7 @@ describe Projects::ProtectedBranchesController do
end
it "prevents creation of the protected branch rule" do
- post(:create, project_params.merge(protected_branch: create_params))
+ post(:create, params: project_params.merge(protected_branch: create_params))
expect(ProtectedBranch.count).to eq 0
end
@@ -59,7 +59,7 @@ describe Projects::ProtectedBranchesController do
end
it 'updates the protected branch rule' do
- put(:update, base_params.merge(protected_branch: update_params))
+ put(:update, params: base_params.merge(protected_branch: update_params))
expect(protected_branch.reload.name).to eq('new_name')
expect(json_response["name"]).to eq('new_name')
@@ -74,7 +74,7 @@ describe Projects::ProtectedBranchesController do
it "prevents update of the protected branch rule" do
old_name = protected_branch.name
- put(:update, base_params.merge(protected_branch: update_params))
+ put(:update, params: base_params.merge(protected_branch: update_params))
expect(protected_branch.reload.name).to eq(old_name)
end
@@ -87,7 +87,7 @@ describe Projects::ProtectedBranchesController do
end
it "deletes the protected branch rule" do
- delete(:destroy, base_params)
+ delete(:destroy, params: base_params)
expect { ProtectedBranch.find(protected_branch.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -99,7 +99,7 @@ describe Projects::ProtectedBranchesController do
end
it "prevents deletion of the protected branch rule" do
- delete(:destroy, base_params)
+ delete(:destroy, params: base_params)
expect(response.status).to eq(403)
end
diff --git a/spec/controllers/projects/protected_tags_controller_spec.rb b/spec/controllers/projects/protected_tags_controller_spec.rb
index 20440c5a5d5..1553e081dee 100644
--- a/spec/controllers/projects/protected_tags_controller_spec.rb
+++ b/spec/controllers/projects/protected_tags_controller_spec.rb
@@ -5,7 +5,7 @@ describe Projects::ProtectedTagsController do
let(:project) { create(:project_empty_repo, :public) }
it "redirects empty repo to projects page" do
- get(:index, namespace_id: project.namespace.to_param, project_id: project)
+ get(:index, params: { namespace_id: project.namespace.to_param, project_id: project })
end
end
@@ -20,7 +20,7 @@ describe Projects::ProtectedTagsController do
end
it "deletes the protected tag" do
- delete(:destroy, namespace_id: project.namespace.to_param, project_id: project, id: protected_tag.id)
+ delete(:destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: protected_tag.id })
expect { ProtectedTag.find(protected_tag.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb
index d3cd15fbcd7..24e2441cf9d 100644
--- a/spec/controllers/projects/raw_controller_spec.rb
+++ b/spec/controllers/projects/raw_controller_spec.rb
@@ -6,9 +6,11 @@ describe Projects::RawController do
describe 'GET #show' do
subject do
get(:show,
- namespace_id: project.namespace,
- project_id: project,
- id: filepath)
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: filepath
+ })
end
context 'regular filename' do
diff --git a/spec/controllers/projects/refs_controller_spec.rb b/spec/controllers/projects/refs_controller_spec.rb
index ceaffd92623..ea299e1e8c5 100644
--- a/spec/controllers/projects/refs_controller_spec.rb
+++ b/spec/controllers/projects/refs_controller_spec.rb
@@ -12,10 +12,12 @@ describe Projects::RefsController do
describe 'GET #logs_tree' do
def default_get(format = :html)
get :logs_tree,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: 'master',
- path: 'foo/bar/baz.html',
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: 'master',
+ path: 'foo/bar/baz.html'
+ },
format: format
end
diff --git a/spec/controllers/projects/registry/repositories_controller_spec.rb b/spec/controllers/projects/registry/repositories_controller_spec.rb
index d11e42b411b..eca187af33d 100644
--- a/spec/controllers/projects/registry/repositories_controller_spec.rb
+++ b/spec/controllers/projects/registry/repositories_controller_spec.rb
@@ -111,15 +111,19 @@ describe Projects::Registry::RepositoriesController do
end
def go_to_index(format: :html)
- get :index, namespace_id: project.namespace,
- project_id: project,
+ get :index, params: {
+ namespace_id: project.namespace,
+ project_id: project
+ },
format: format
end
def delete_repository(repository)
- delete :destroy, namespace_id: project.namespace,
- project_id: project,
- id: repository,
+ delete :destroy, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: repository
+ },
format: :json
end
end
diff --git a/spec/controllers/projects/registry/tags_controller_spec.rb b/spec/controllers/projects/registry/tags_controller_spec.rb
index 7fee8fd44ff..ed0197afcfc 100644
--- a/spec/controllers/projects/registry/tags_controller_spec.rb
+++ b/spec/controllers/projects/registry/tags_controller_spec.rb
@@ -65,9 +65,11 @@ describe Projects::Registry::TagsController do
private
def get_tags
- get :index, namespace_id: project.namespace,
- project_id: project,
- repository_id: repository,
+ get :index, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ repository_id: repository
+ },
format: :json
end
end
@@ -100,10 +102,12 @@ describe Projects::Registry::TagsController do
private
def destroy_tag(name)
- post :destroy, namespace_id: project.namespace,
- project_id: project,
- repository_id: repository,
- id: name,
+ post :destroy, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ repository_id: repository,
+ id: name
+ },
format: :json
end
end
diff --git a/spec/controllers/projects/releases_controller_spec.rb b/spec/controllers/projects/releases_controller_spec.rb
index d9fb6e0d838..f170a2ab613 100644
--- a/spec/controllers/projects/releases_controller_spec.rb
+++ b/spec/controllers/projects/releases_controller_spec.rb
@@ -60,6 +60,6 @@ describe Projects::ReleasesController do
private
def get_index
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
end
end
diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb
index a102a3a3c8c..5f4f6f8558f 100644
--- a/spec/controllers/projects/repositories_controller_spec.rb
+++ b/spec/controllers/projects/repositories_controller_spec.rb
@@ -6,7 +6,7 @@ describe Projects::RepositoriesController do
describe "GET archive" do
context 'as a guest' do
it 'responds with redirect in correct format' do
- get :archive, namespace_id: project.namespace, project_id: project, id: "master", format: "zip"
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip"
expect(response.header["Content-Type"]).to start_with('text/html')
expect(response).to be_redirect
@@ -22,26 +22,26 @@ describe Projects::RepositoriesController do
end
it "uses Gitlab::Workhorse" do
- get :archive, namespace_id: project.namespace, project_id: project, id: "master", format: "zip"
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip"
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
it 'responds with redirect to the short name archive if fully qualified' do
- get :archive, namespace_id: project.namespace, project_id: project, id: "master/#{project.path}-master", format: "zip"
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master/#{project.path}-master" }, format: "zip"
expect(assigns(:ref)).to eq("master")
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
it 'handles legacy queries with no ref' do
- get :archive, namespace_id: project.namespace, project_id: project, format: "zip"
+ get :archive, params: { namespace_id: project.namespace, project_id: project }, format: "zip"
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
it 'handles legacy queries with the ref specified as ref in params' do
- get :archive, namespace_id: project.namespace, project_id: project, ref: 'feature', format: 'zip'
+ get :archive, params: { namespace_id: project.namespace, project_id: project, ref: 'feature' }, format: 'zip'
expect(response).to have_gitlab_http_status(200)
expect(assigns(:ref)).to eq('feature')
@@ -49,7 +49,7 @@ describe Projects::RepositoriesController do
end
it 'handles legacy queries with the ref specified as id in params' do
- get :archive, namespace_id: project.namespace, project_id: project, id: 'feature', format: 'zip'
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature' }, format: 'zip'
expect(response).to have_gitlab_http_status(200)
expect(assigns(:ref)).to eq('feature')
@@ -57,7 +57,7 @@ describe Projects::RepositoriesController do
end
it 'prioritizes the id param over the ref param when both are specified' do
- get :archive, namespace_id: project.namespace, project_id: project, id: 'feature', ref: 'feature_conflict', format: 'zip'
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'feature', ref: 'feature_conflict' }, format: 'zip'
expect(response).to have_gitlab_http_status(200)
expect(assigns(:ref)).to eq('feature')
@@ -70,7 +70,7 @@ describe Projects::RepositoriesController do
end
it "renders Not Found" do
- get :archive, namespace_id: project.namespace, project_id: project, id: "master", format: "zip"
+ get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip"
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/projects/runners_controller_spec.rb b/spec/controllers/projects/runners_controller_spec.rb
index b1e0b496ede..0baaa4e7192 100644
--- a/spec/controllers/projects/runners_controller_spec.rb
+++ b/spec/controllers/projects/runners_controller_spec.rb
@@ -23,7 +23,7 @@ describe Projects::RunnersController do
new_desc = runner.description.swapcase
expect do
- post :update, params.merge(runner: { description: new_desc } )
+ post :update, params: params.merge(runner: { description: new_desc } )
end.to change { runner.ensure_runner_queue_value }
runner.reload
@@ -35,7 +35,7 @@ describe Projects::RunnersController do
describe '#destroy' do
it 'destroys the runner' do
- delete :destroy, params
+ delete :destroy, params: params
expect(response).to have_gitlab_http_status(302)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
@@ -47,7 +47,7 @@ describe Projects::RunnersController do
runner.update(active: false)
expect do
- post :resume, params
+ post :resume, params: params
end.to change { runner.ensure_runner_queue_value }
runner.reload
@@ -62,7 +62,7 @@ describe Projects::RunnersController do
runner.update(active: true)
expect do
- post :pause, params
+ post :pause, params: params
end.to change { runner.ensure_runner_queue_value }
runner.reload
diff --git a/spec/controllers/projects/serverless/functions_controller_spec.rb b/spec/controllers/projects/serverless/functions_controller_spec.rb
index 284b582b1f5..a9759c4fbd8 100644
--- a/spec/controllers/projects/serverless/functions_controller_spec.rb
+++ b/spec/controllers/projects/serverless/functions_controller_spec.rb
@@ -32,13 +32,13 @@ describe Projects::Serverless::FunctionsController do
describe 'GET #index' do
context 'empty cache' do
it 'has no data' do
- get :index, params({ format: :json })
+ get :index, params: params({ format: :json })
expect(response).to have_gitlab_http_status(204)
end
it 'renders an html page' do
- get :index, params
+ get :index, params: params
expect(response).to have_gitlab_http_status(200)
end
@@ -51,7 +51,7 @@ describe Projects::Serverless::FunctionsController do
end
it 'has data' do
- get :index, params({ format: :json })
+ get :index, params: params({ format: :json })
expect(response).to have_gitlab_http_status(200)
@@ -64,7 +64,7 @@ describe Projects::Serverless::FunctionsController do
end
it 'has data in html' do
- get :index, params
+ get :index, params: params
expect(response).to have_gitlab_http_status(200)
end
diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb
index 0941af6779f..4a5d2bdecb7 100644
--- a/spec/controllers/projects/services_controller_spec.rb
+++ b/spec/controllers/projects/services_controller_spec.rb
@@ -16,7 +16,7 @@ describe Projects::ServicesController do
it 'renders 404' do
allow_any_instance_of(Service).to receive(:can_test?).and_return(false)
- put :test, namespace_id: project.namespace, project_id: project, id: service.to_param
+ put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param }
expect(response).to have_gitlab_http_status(404)
end
@@ -26,7 +26,7 @@ describe Projects::ServicesController do
let(:service_params) { { active: 'true', url: '' } }
it 'returns error messages in JSON response' do
- put :test, namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params
+ put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params }
expect(json_response['message']).to eq "Validations failed."
expect(json_response['service_response']).to include "Url can't be blank"
@@ -44,7 +44,7 @@ describe Projects::ServicesController do
it 'returns success' do
allow_any_instance_of(MicrosoftTeams::Notifier).to receive(:ping).and_return(true)
- put :test, namespace_id: project.namespace, project_id: project, id: service.to_param
+ put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param }
expect(response.status).to eq(200)
end
@@ -54,7 +54,7 @@ describe Projects::ServicesController do
stub_request(:get, 'http://example.com/rest/api/2/serverInfo')
.to_return(status: 200, body: '{}')
- put :test, namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params
+ put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params }
expect(response.status).to eq(200)
end
@@ -64,7 +64,7 @@ describe Projects::ServicesController do
stub_request(:get, 'http://example.com/rest/api/2/serverInfo')
.to_return(status: 200, body: '{}')
- put :test, namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params
+ put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params }
expect(response.status).to eq(200)
end
@@ -91,10 +91,12 @@ describe Projects::ServicesController do
end
def do_put
- put :test, namespace_id: project.namespace,
- project_id: project,
- id: 'buildkite',
- service: { 'active' => '1', 'push_events' => '1', token: 'token', 'project_url' => 'http://test.com' }
+ put :test, params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: 'buildkite',
+ service: { 'active' => '1', 'push_events' => '1', token: 'token', 'project_url' => 'http://test.com' }
+ }
end
end
end
@@ -104,7 +106,7 @@ describe Projects::ServicesController do
stub_request(:get, 'http://example.com/rest/api/2/serverInfo')
.to_return(status: 404)
- put :test, namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params
+ put :test, params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: service_params }
expect(response).to have_gitlab_http_status(200)
expect(json_response).to eq(
@@ -121,7 +123,7 @@ describe Projects::ServicesController do
context 'when param `active` is set to true' do
it 'activates the service and redirects to integrations paths' do
put :update,
- namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: true }
+ params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: true } }
expect(response).to redirect_to(project_settings_integrations_path(project))
expect(flash[:notice]).to eq 'JIRA activated.'
@@ -131,7 +133,7 @@ describe Projects::ServicesController do
context 'when param `active` is set to false' do
it 'does not activate the service but saves the settings' do
put :update,
- namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: false }
+ params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { active: false } }
expect(flash[:notice]).to eq 'JIRA settings saved, but not activated.'
end
@@ -142,7 +144,7 @@ describe Projects::ServicesController do
before do
put :update,
- namespace_id: project.namespace, project_id: project, id: service.to_param, service: { namespace: 'updated_namespace' }
+ params: { namespace_id: project.namespace, project_id: project, id: service.to_param, service: { namespace: 'updated_namespace' } }
end
it 'should not update the service' do
@@ -154,7 +156,7 @@ describe Projects::ServicesController do
describe "GET #edit" do
before do
- get :edit, namespace_id: project.namespace, project_id: project, id: service_id
+ get :edit, params: { namespace_id: project.namespace, project_id: project, id: service_id }
end
context 'with approved services' do
diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
index 4629929f9af..41cc0607cee 100644
--- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb
+++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
@@ -12,7 +12,7 @@ describe Projects::Settings::CiCdController do
describe 'GET show' do
it 'renders show with 200 status code' do
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:show)
@@ -29,7 +29,7 @@ describe Projects::Settings::CiCdController do
it 'sets assignable project runners only' do
group.add_maintainer(user)
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:assignable_runners)).to contain_exactly(project_runner)
end
@@ -45,7 +45,7 @@ describe Projects::Settings::CiCdController do
allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true)
end
- subject { post :reset_cache, namespace_id: project.namespace, project_id: project, format: :json }
+ subject { post :reset_cache, params: { namespace_id: project.namespace, project_id: project }, format: :json }
it 'calls reset project cache service' do
expect(ResetProjectCacheService).to receive_message_chain(:new, :execute)
@@ -75,7 +75,7 @@ describe Projects::Settings::CiCdController do
end
describe 'PUT #reset_registration_token' do
- subject { put :reset_registration_token, namespace_id: project.namespace, project_id: project }
+ subject { put :reset_registration_token, params: { namespace_id: project.namespace, project_id: project } }
it 'resets runner registration token' do
expect { subject }.to change { project.reload.runners_token }
end
@@ -92,9 +92,11 @@ describe Projects::Settings::CiCdController do
subject do
patch :update,
- namespace_id: project.namespace.to_param,
- project_id: project,
- project: params
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ project: params
+ }
end
it 'redirects to the settings page' do
diff --git a/spec/controllers/projects/settings/integrations_controller_spec.rb b/spec/controllers/projects/settings/integrations_controller_spec.rb
index a2484c04c7a..8624eb4d1a0 100644
--- a/spec/controllers/projects/settings/integrations_controller_spec.rb
+++ b/spec/controllers/projects/settings/integrations_controller_spec.rb
@@ -11,7 +11,7 @@ describe Projects::Settings::IntegrationsController do
describe 'GET show' do
it 'renders show with 200 status code' do
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:show)
diff --git a/spec/controllers/projects/settings/repository_controller_spec.rb b/spec/controllers/projects/settings/repository_controller_spec.rb
index 1c6ddfc1864..638cce60a25 100644
--- a/spec/controllers/projects/settings/repository_controller_spec.rb
+++ b/spec/controllers/projects/settings/repository_controller_spec.rb
@@ -11,7 +11,7 @@ describe Projects::Settings::RepositoryController do
describe 'GET show' do
it 'renders show with 200 status code' do
- get :show, namespace_id: project.namespace, project_id: project
+ get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template(:show)
@@ -24,7 +24,7 @@ describe Projects::Settings::RepositoryController do
it 'enqueues a RepositoryCleanupWorker' do
allow(RepositoryCleanupWorker).to receive(:perform_async)
- put :cleanup, namespace_id: project.namespace, project_id: project, project: { object_map: object_map }
+ put :cleanup, params: { namespace_id: project.namespace, project_id: project, project: { object_map: object_map } }
expect(response).to redirect_to project_settings_repository_path(project)
expect(RepositoryCleanupWorker).to have_received(:perform_async).once
diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb
index 9c383bd7628..1a3fb4da15f 100644
--- a/spec/controllers/projects/snippets_controller_spec.rb
+++ b/spec/controllers/projects/snippets_controller_spec.rb
@@ -17,16 +17,22 @@ describe Projects::SnippetsController do
it 'redirects to last_page if page number is larger than number of pages' do
get :index,
- namespace_id: project.namespace,
- project_id: project, page: (last_page + 1).to_param
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ page: (last_page + 1).to_param
+ }
expect(response).to redirect_to(namespace_project_snippets_path(page: last_page))
end
it 'redirects to specified page' do
get :index,
- namespace_id: project.namespace,
- project_id: project, page: last_page.to_param
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ page: last_page.to_param
+ }
expect(assigns(:snippets).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(200)
@@ -38,7 +44,7 @@ describe Projects::SnippetsController do
context 'when anonymous' do
it 'does not include the private snippet' do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:snippets)).not_to include(project_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -51,7 +57,7 @@ describe Projects::SnippetsController do
end
it 'renders the snippet' do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:snippets)).to include(project_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -64,7 +70,7 @@ describe Projects::SnippetsController do
end
it 'renders the snippet' do
- get :index, namespace_id: project.namespace, project_id: project
+ get :index, params: { namespace_id: project.namespace, project_id: project }
expect(assigns(:snippets)).to include(project_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -79,7 +85,7 @@ describe Projects::SnippetsController do
project.add_developer(user)
- post :create, {
+ post :create, params: {
namespace_id: project.namespace.to_param,
project_id: project,
project_snippet: { title: 'Title', content: 'Content', description: 'Description' }.merge(snippet_params)
@@ -164,7 +170,7 @@ describe Projects::SnippetsController do
project.add_developer(user)
- put :update, {
+ put :update, params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: snippet.id,
@@ -295,9 +301,11 @@ describe Projects::SnippetsController do
sign_in(admin)
post :mark_as_spam,
- namespace_id: project.namespace,
- project_id: project,
- id: snippet.id
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: snippet.id
+ }
end
it 'updates the snippet' do
@@ -314,7 +322,7 @@ describe Projects::SnippetsController do
context 'when anonymous' do
it 'responds with status 404' do
- get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param
+ get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
expect(response).to have_gitlab_http_status(404)
end
@@ -326,7 +334,7 @@ describe Projects::SnippetsController do
end
it 'renders the snippet' do
- get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param
+ get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -339,7 +347,7 @@ describe Projects::SnippetsController do
end
it 'renders the snippet' do
- get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param
+ get action, params: { namespace_id: project.namespace, project_id: project, id: project_snippet.to_param }
expect(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -350,7 +358,7 @@ describe Projects::SnippetsController do
context 'when the project snippet does not exist' do
context 'when anonymous' do
it 'responds with status 404' do
- get action, namespace_id: project.namespace, project_id: project, id: 42
+ get action, params: { namespace_id: project.namespace, project_id: project, id: 42 }
expect(response).to have_gitlab_http_status(404)
end
@@ -362,7 +370,7 @@ describe Projects::SnippetsController do
end
it 'responds with status 404' do
- get action, namespace_id: project.namespace, project_id: project, id: 42
+ get action, params: { namespace_id: project.namespace, project_id: project, id: 42 }
expect(response).to have_gitlab_http_status(404)
end
@@ -391,13 +399,13 @@ describe Projects::SnippetsController do
end
it 'returns LF line endings by default' do
- get :raw, params
+ get :raw, params: params
expect(response.body).to eq("first line\nsecond line\nthird line")
end
it 'does not convert line endings when parameter present' do
- get :raw, params.merge(line_ending: :raw)
+ get :raw, params: params.merge(line_ending: :raw)
expect(response.body).to eq("first line\r\nsecond line\r\nthird line")
end
diff --git a/spec/controllers/projects/tags_controller_spec.rb b/spec/controllers/projects/tags_controller_spec.rb
index 6fbf75d0259..379430bff3b 100644
--- a/spec/controllers/projects/tags_controller_spec.rb
+++ b/spec/controllers/projects/tags_controller_spec.rb
@@ -7,7 +7,7 @@ describe Projects::TagsController do
describe 'GET index' do
before do
- get :index, namespace_id: project.namespace.to_param, project_id: project
+ get :index, params: { namespace_id: project.namespace.to_param, project_id: project }
end
it 'returns the tags for the page' do
@@ -22,7 +22,7 @@ describe Projects::TagsController do
describe 'GET show' do
before do
- get :show, namespace_id: project.namespace.to_param, project_id: project, id: id
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project, id: id }
end
context "valid tag" do
diff --git a/spec/controllers/projects/templates_controller_spec.rb b/spec/controllers/projects/templates_controller_spec.rb
index d7f07aa2b01..01e53669627 100644
--- a/spec/controllers/projects/templates_controller_spec.rb
+++ b/spec/controllers/projects/templates_controller_spec.rb
@@ -20,7 +20,7 @@ describe Projects::TemplatesController do
describe '#show' do
it 'renders template name and content as json' do
- get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project, format: :json)
+ get(:show, params: { namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project }, format: :json)
expect(response.status).to eq(200)
expect(body["name"]).to eq("bug")
@@ -29,21 +29,21 @@ describe Projects::TemplatesController do
it 'renders 404 when unauthorized' do
sign_in(user2)
- get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project, format: :json)
+ get(:show, params: { namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project }, format: :json)
expect(response.status).to eq(404)
end
it 'renders 404 when template type is not found' do
sign_in(user)
- get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project, format: :json)
+ get(:show, params: { namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project }, format: :json)
expect(response.status).to eq(404)
end
it 'renders 404 without errors' do
sign_in(user)
- expect { get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project, format: :json) }.not_to raise_error
+ expect { get(:show, params: { namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project }, format: :json) }.not_to raise_error
end
end
end
diff --git a/spec/controllers/projects/todos_controller_spec.rb b/spec/controllers/projects/todos_controller_spec.rb
index 58f2817c7cc..987772f38aa 100644
--- a/spec/controllers/projects/todos_controller_spec.rb
+++ b/spec/controllers/projects/todos_controller_spec.rb
@@ -29,10 +29,12 @@ describe Projects::TodosController do
describe 'POST create' do
def post_create
post :create,
- namespace_id: project.namespace,
- project_id: project,
- issuable_id: issue.id,
- issuable_type: 'issue',
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ issuable_id: issue.id,
+ issuable_type: 'issue'
+ },
format: 'html'
end
@@ -44,10 +46,12 @@ describe Projects::TodosController do
describe 'POST create' do
def post_create
post :create,
- namespace_id: project.namespace,
- project_id: project,
- issuable_id: merge_request.id,
- issuable_type: 'merge_request',
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ issuable_id: merge_request.id,
+ issuable_type: 'merge_request'
+ },
format: 'html'
end
diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb
index 9982b49eebb..b15a2bc84a5 100644
--- a/spec/controllers/projects/tree_controller_spec.rb
+++ b/spec/controllers/projects/tree_controller_spec.rb
@@ -17,9 +17,11 @@ describe Projects::TreeController do
before do
get(:show,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ })
end
context "valid branch, no path" do
@@ -73,9 +75,11 @@ describe Projects::TreeController do
before do
get(:show,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: id)
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: id
+ })
end
context 'redirect to blob' do
@@ -93,12 +97,14 @@ describe Projects::TreeController do
before do
post(:create_dir,
- namespace_id: project.namespace.to_param,
- project_id: project,
- id: 'master',
- dir_name: path,
- branch_name: branch_name,
- commit_message: 'Test commit message')
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ id: 'master',
+ dir_name: path,
+ branch_name: branch_name,
+ commit_message: 'Test commit message'
+ })
end
context 'successful creation' do
diff --git a/spec/controllers/projects/uploads_controller_spec.rb b/spec/controllers/projects/uploads_controller_spec.rb
index 9802e4d5b1e..cfa67683dd3 100644
--- a/spec/controllers/projects/uploads_controller_spec.rb
+++ b/spec/controllers/projects/uploads_controller_spec.rb
@@ -12,7 +12,7 @@ describe Projects::UploadsController do
context 'when the URL the old style, without /-/system' do
it 'responds with a redirect to the login page' do
- get :show, namespace_id: 'project', project_id: 'avatar', filename: 'foo.png', secret: 'bar'
+ get :show, params: { namespace_id: 'project', project_id: 'avatar', filename: 'foo.png', secret: 'bar' }
expect(response).to redirect_to(new_user_session_path)
end
@@ -35,6 +35,6 @@ describe Projects::UploadsController do
def post_authorize(verified: true)
request.headers.merge!(workhorse_internal_api_request_header) if verified
- post :authorize, namespace_id: model.namespace, project_id: model.path, format: :json
+ post :authorize, params: { namespace_id: model.namespace, project_id: model.path }, format: :json
end
end
diff --git a/spec/controllers/projects/variables_controller_spec.rb b/spec/controllers/projects/variables_controller_spec.rb
index 9afd1f751c6..8cceda72c28 100644
--- a/spec/controllers/projects/variables_controller_spec.rb
+++ b/spec/controllers/projects/variables_controller_spec.rb
@@ -13,7 +13,7 @@ describe Projects::VariablesController do
let!(:variable) { create(:ci_variable, project: project) }
subject do
- get :show, namespace_id: project.namespace.to_param, project_id: project, format: :json
+ get :show, params: { namespace_id: project.namespace.to_param, project_id: project }, format: :json
end
include_examples 'GET #show lists all variables'
@@ -25,9 +25,11 @@ describe Projects::VariablesController do
subject do
patch :update,
- namespace_id: project.namespace.to_param,
- project_id: project,
- variables_attributes: variables_attributes,
+ params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ variables_attributes: variables_attributes
+ },
format: :json
end
diff --git a/spec/controllers/projects/wikis_controller_spec.rb b/spec/controllers/projects/wikis_controller_spec.rb
index b974d927856..341bf244397 100644
--- a/spec/controllers/projects/wikis_controller_spec.rb
+++ b/spec/controllers/projects/wikis_controller_spec.rb
@@ -20,7 +20,7 @@ describe Projects::WikisController do
describe 'GET #show' do
render_views
- subject { get :show, namespace_id: project.namespace, project_id: project, id: wiki_title }
+ subject { get :show, params: { namespace_id: project.namespace, project_id: project, id: wiki_title } }
it 'limits the retrieved pages for the sidebar' do
expect(controller).to receive(:load_wiki).and_return(project_wiki)
@@ -52,7 +52,7 @@ describe Projects::WikisController do
let(:path) { upload_file_to_wiki(project, user, file_name) }
- subject { get :show, namespace_id: project.namespace, project_id: project, id: path }
+ subject { get :show, params: { namespace_id: project.namespace, project_id: project, id: path } }
context 'when file is an image' do
let(:file_name) { 'dk.png' }
@@ -142,14 +142,14 @@ describe Projects::WikisController do
describe 'POST #preview_markdown' do
it 'renders json in a correct format' do
- post :preview_markdown, namespace_id: project.namespace, project_id: project, id: 'page/path', text: '*Markdown* text'
+ post :preview_markdown, params: { namespace_id: project.namespace, project_id: project, id: 'page/path', text: '*Markdown* text' }
expect(JSON.parse(response.body).keys).to match_array(%w(body references))
end
end
describe 'GET #edit' do
- subject { get(:edit, namespace_id: project.namespace, project_id: project, id: wiki_title) }
+ subject { get(:edit, params: { namespace_id: project.namespace, project_id: project, id: wiki_title }) }
context 'when page content encoding is invalid' do
it 'redirects to show' do
@@ -178,10 +178,12 @@ describe Projects::WikisController do
let(:new_content) { 'New content' }
subject do
patch(:update,
- namespace_id: project.namespace,
- project_id: project,
- id: wiki_title,
- wiki: { title: new_title, content: new_content })
+ params: {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: wiki_title,
+ wiki: { title: new_title, content: new_content }
+ })
end
context 'when page content encoding is invalid' do
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 576191a5788..ea067a01295 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -22,7 +22,7 @@ describe ProjectsController do
it 'renders the template' do
group.add_owner(user)
- get :new, namespace_id: group.id
+ get :new, params: { namespace_id: group.id }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('new')
@@ -31,7 +31,7 @@ describe ProjectsController do
context 'when user does not have access to the namespace' do
it 'responds with status 404' do
- get :new, namespace_id: group.id
+ get :new, params: { namespace_id: group.id }
expect(response).to have_gitlab_http_status(404)
expect(response).not_to render_template('new')
@@ -71,7 +71,7 @@ describe ProjectsController do
let(:private_project) { create(:project, :private) }
it "does not initialize notification setting" do
- get :show, namespace_id: private_project.namespace, id: private_project
+ get :show, params: { namespace_id: private_project.namespace, id: private_project }
expect(assigns(:notification_setting)).to be_nil
end
end
@@ -79,7 +79,7 @@ describe ProjectsController do
context "user has access to project" do
context "and does not have notification setting" do
it "initializes notification as disabled" do
- get :show, namespace_id: public_project.namespace, id: public_project
+ get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(assigns(:notification_setting).level).to eq("global")
end
end
@@ -92,7 +92,7 @@ describe ProjectsController do
end
it "shows current notification setting" do
- get :show, namespace_id: public_project.namespace, id: public_project
+ get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(assigns(:notification_setting).level).to eq("watch")
end
end
@@ -107,7 +107,7 @@ describe ProjectsController do
end
it 'shows wiki homepage' do
- get :show, namespace_id: project.namespace, id: project
+ get :show, params: { namespace_id: project.namespace, id: project }
expect(response).to render_template('projects/_wiki')
end
@@ -116,7 +116,7 @@ describe ProjectsController do
project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED)
create(:issue, project: project)
- get :show, namespace_id: project.namespace, id: project
+ get :show, params: { namespace_id: project.namespace, id: project }
expect(response).to render_template('projects/issues/_issues')
expect(assigns(:issuable_meta_data)).not_to be_nil
@@ -126,7 +126,7 @@ describe ProjectsController do
project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED)
project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED)
- get :show, namespace_id: project.namespace, id: project
+ get :show, params: { namespace_id: project.namespace, id: project }
expect(response).to render_template("projects/_customize_workflow")
end
@@ -134,7 +134,7 @@ describe ProjectsController do
it 'shows activity if enabled by user' do
user.update_attribute(:project_view, 'activity')
- get :show, namespace_id: project.namespace, id: project
+ get :show, params: { namespace_id: project.namespace, id: project }
expect(response).to render_template("projects/_activity")
end
@@ -150,7 +150,7 @@ describe ProjectsController do
end
it 'renders a 503' do
- get :show, namespace_id: project.namespace, id: project
+ get :show, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(503)
end
@@ -168,7 +168,7 @@ describe ProjectsController do
before do
user.update(project_view: project_view)
- get :show, namespace_id: empty_project.namespace, id: empty_project
+ get :show, params: { namespace_id: empty_project.namespace, id: empty_project }
end
it "renders the empty project view" do
@@ -190,7 +190,7 @@ describe ProjectsController do
before do
user.update(project_view: project_view)
- get :show, namespace_id: empty_project.namespace, id: empty_project
+ get :show, params: { namespace_id: empty_project.namespace, id: empty_project }
end
it "renders the empty project view" do
@@ -211,7 +211,7 @@ describe ProjectsController do
allow(controller).to receive(:current_user).and_return(user)
allow(user).to receive(:project_view).and_return('activity')
- get :show, namespace_id: public_project.namespace, id: public_project
+ get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(response).to render_template('_activity')
end
@@ -219,7 +219,7 @@ describe ProjectsController do
allow(controller).to receive(:current_user).and_return(user)
allow(user).to receive(:project_view).and_return('files')
- get :show, namespace_id: public_project.namespace, id: public_project
+ get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(response).to render_template('_files')
end
@@ -227,7 +227,7 @@ describe ProjectsController do
allow(controller).to receive(:current_user).and_return(user)
allow(user).to receive(:project_view).and_return('readme')
- get :show, namespace_id: public_project.namespace, id: public_project
+ get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(response).to render_template('_readme')
end
end
@@ -245,7 +245,7 @@ describe ProjectsController do
project = create(:project, pending_delete: true)
sign_in(user)
- get :show, namespace_id: project.namespace, id: project
+ get :show, params: { namespace_id: project.namespace, id: project }
expect(response.status).to eq 404
end
@@ -255,7 +255,7 @@ describe ProjectsController do
it 'redirects to project page (format.html)' do
project = create(:project, :public)
- get :show, namespace_id: project.namespace, id: project, format: :git
+ get :show, params: { namespace_id: project.namespace, id: project }, format: :git
expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(namespace_project_path)
@@ -278,7 +278,7 @@ describe ProjectsController do
it 'does not increase the number of queries when the project is forked' do
expected_query = /#{public_project.fork_network.find_forks_in(other_user.namespace).to_sql}/
- expect { get(:show, namespace_id: public_project.namespace, id: public_project) }
+ expect { get(:show, params: { namespace_id: public_project.namespace, id: public_project }) }
.not_to exceed_query_limit(2).for_query(expected_query)
end
end
@@ -290,8 +290,10 @@ describe ProjectsController do
project.add_maintainer(user)
get :edit,
- namespace_id: project.namespace.path,
- id: project.path
+ params: {
+ namespace_id: project.namespace.path,
+ id: project.path
+ }
expect(assigns(:badge_api_endpoint)).not_to be_nil
end
@@ -355,9 +357,11 @@ describe ProjectsController do
}
put :update,
- namespace_id: project.namespace,
- id: project.id,
- project: params
+ params: {
+ namespace_id: project.namespace,
+ id: project.id,
+ project: params
+ }
expect(response).to have_gitlab_http_status(302)
params.each do |param, value|
@@ -367,9 +371,11 @@ describe ProjectsController do
def update_project(**parameters)
put :update,
- namespace_id: project.namespace.path,
- id: project.path,
- project: parameters
+ params: {
+ namespace_id: project.namespace.path,
+ id: project.path,
+ project: parameters
+ }
end
end
@@ -397,9 +403,11 @@ describe ProjectsController do
sign_in(admin)
put :transfer,
- namespace_id: project.namespace.path,
- new_namespace_id: new_namespace.id,
- id: project.path,
+ params: {
+ namespace_id: project.namespace.path,
+ new_namespace_id: new_namespace.id,
+ id: project.path
+ },
format: :js
project.reload
@@ -416,9 +424,11 @@ describe ProjectsController do
old_namespace = project.namespace
put :transfer,
- namespace_id: old_namespace.path,
- new_namespace_id: nil,
- id: project.path,
+ params: {
+ namespace_id: old_namespace.path,
+ new_namespace_id: nil,
+ id: project.path
+ },
format: :js
project.reload
@@ -438,7 +448,7 @@ describe ProjectsController do
sign_in(admin)
orig_id = project.id
- delete :destroy, namespace_id: project.namespace, id: project
+ delete :destroy, params: { namespace_id: project.namespace, id: project }
expect { Project.find(orig_id) }.to raise_error(ActiveRecord::RecordNotFound)
expect(response).to have_gitlab_http_status(302)
@@ -458,7 +468,7 @@ describe ProjectsController do
project.merge_requests << merge_request
sign_in(admin)
- delete :destroy, namespace_id: forked_project.namespace, id: forked_project
+ delete :destroy, params: { namespace_id: forked_project.namespace, id: forked_project }
expect(merge_request.reload.state).to eq('closed')
end
@@ -468,9 +478,11 @@ describe ProjectsController do
describe 'PUT #new_issuable_address for issue' do
subject do
put :new_issuable_address,
- namespace_id: project.namespace,
- id: project,
- issuable_type: 'issue'
+ params: {
+ namespace_id: project.namespace,
+ id: project,
+ issuable_type: 'issue'
+ }
user.reload
end
@@ -496,9 +508,11 @@ describe ProjectsController do
describe 'PUT #new_issuable_address for merge request' do
subject do
put :new_issuable_address,
- namespace_id: project.namespace,
- id: project,
- issuable_type: 'merge_request'
+ params: {
+ namespace_id: project.namespace,
+ id: project,
+ issuable_type: 'merge_request'
+ }
user.reload
end
@@ -526,23 +540,31 @@ describe ProjectsController do
sign_in(user)
expect(user.starred?(public_project)).to be_falsey
post(:toggle_star,
- namespace_id: public_project.namespace,
- id: public_project)
+ params: {
+ namespace_id: public_project.namespace,
+ id: public_project
+ })
expect(user.starred?(public_project)).to be_truthy
post(:toggle_star,
- namespace_id: public_project.namespace,
- id: public_project)
+ params: {
+ namespace_id: public_project.namespace,
+ id: public_project
+ })
expect(user.starred?(public_project)).to be_falsey
end
it "does nothing if user is not signed in" do
post(:toggle_star,
- namespace_id: project.namespace,
- id: public_project)
+ params: {
+ namespace_id: project.namespace,
+ id: public_project
+ })
expect(user.starred?(public_project)).to be_falsey
post(:toggle_star,
- namespace_id: project.namespace,
- id: public_project)
+ params: {
+ namespace_id: project.namespace,
+ id: public_project
+ })
expect(user.starred?(public_project)).to be_falsey
end
end
@@ -558,8 +580,11 @@ describe ProjectsController do
it 'removes fork from project' do
delete(:remove_fork,
- namespace_id: forked_project.namespace.to_param,
- id: forked_project.to_param, format: :js)
+ params: {
+ namespace_id: forked_project.namespace.to_param,
+ id: forked_project.to_param
+ },
+ format: :js)
expect(forked_project.reload.forked?).to be_falsey
expect(flash[:notice]).to eq('The fork relationship has been removed.')
@@ -572,8 +597,11 @@ describe ProjectsController do
it 'does nothing if project was not forked' do
delete(:remove_fork,
- namespace_id: unforked_project.namespace,
- id: unforked_project, format: :js)
+ params: {
+ namespace_id: unforked_project.namespace,
+ id: unforked_project
+ },
+ format: :js)
expect(flash[:notice]).to be_nil
expect(response).to render_template(:remove_fork)
@@ -583,8 +611,11 @@ describe ProjectsController do
it "does nothing if user is not signed in" do
delete(:remove_fork,
- namespace_id: project.namespace,
- id: project, format: :js)
+ params: {
+ namespace_id: project.namespace,
+ id: project
+ },
+ format: :js)
expect(response).to have_gitlab_http_status(401)
end
end
@@ -593,7 +624,7 @@ describe ProjectsController do
let(:public_project) { create(:project, :public, :repository) }
it 'gets a list of branches and tags' do
- get :refs, namespace_id: public_project.namespace, id: public_project, sort: 'updated_desc'
+ get :refs, params: { namespace_id: public_project.namespace, id: public_project, sort: 'updated_desc' }
parsed_body = JSON.parse(response.body)
expect(parsed_body['Branches']).to include('master')
@@ -603,7 +634,7 @@ describe ProjectsController do
end
it "gets a list of branches, tags and commits" do
- get :refs, namespace_id: public_project.namespace, id: public_project, ref: "123456"
+ get :refs, params: { namespace_id: public_project.namespace, id: public_project, ref: "123456" }
parsed_body = JSON.parse(response.body)
expect(parsed_body["Branches"]).to include("master")
@@ -618,7 +649,7 @@ describe ProjectsController do
end
it "gets a list of branches, tags and commits" do
- get :refs, namespace_id: public_project.namespace, id: public_project, ref: "123456"
+ get :refs, params: { namespace_id: public_project.namespace, id: public_project, ref: "123456" }
parsed_body = JSON.parse(response.body)
expect(parsed_body["Branches"]).to include("master")
@@ -634,7 +665,7 @@ describe ProjectsController do
end
it 'renders json in a correct format' do
- post :preview_markdown, namespace_id: public_project.namespace, id: public_project, text: '*Markdown* text'
+ post :preview_markdown, params: { namespace_id: public_project.namespace, id: public_project, text: '*Markdown* text' }
expect(JSON.parse(response.body).keys).to match_array(%w(body references))
end
@@ -644,9 +675,11 @@ describe ProjectsController do
let(:merge_request) { create(:merge_request, :closed, target_project: public_project) }
it 'renders JSON body with state filter for issues' do
- post :preview_markdown, namespace_id: public_project.namespace,
- id: public_project,
- text: issue.to_reference
+ post :preview_markdown, params: {
+ namespace_id: public_project.namespace,
+ id: public_project,
+ text: issue.to_reference
+ }
json_response = JSON.parse(response.body)
@@ -654,9 +687,11 @@ describe ProjectsController do
end
it 'renders JSON body with state filter for MRs' do
- post :preview_markdown, namespace_id: public_project.namespace,
- id: public_project,
- text: merge_request.to_reference
+ post :preview_markdown, params: {
+ namespace_id: public_project.namespace,
+ id: public_project,
+ text: merge_request.to_reference
+ }
json_response = JSON.parse(response.body)
@@ -674,7 +709,7 @@ describe ProjectsController do
context 'when requesting the canonical path' do
context "with exactly matching casing" do
it "loads the project" do
- get :show, namespace_id: public_project.namespace, id: public_project
+ get :show, params: { namespace_id: public_project.namespace, id: public_project }
expect(assigns(:project)).to eq(public_project)
expect(response).to have_gitlab_http_status(200)
@@ -683,7 +718,7 @@ describe ProjectsController do
context "with different casing" do
it "redirects to the normalized path" do
- get :show, namespace_id: public_project.namespace, id: public_project.path.upcase
+ get :show, params: { namespace_id: public_project.namespace, id: public_project.path.upcase }
expect(assigns(:project)).to eq(public_project)
expect(response).to redirect_to("/#{public_project.full_path}")
@@ -696,14 +731,14 @@ describe ProjectsController do
let!(:redirect_route) { public_project.redirect_routes.create!(path: "foo/bar") }
it 'redirects to the canonical path' do
- get :show, namespace_id: 'foo', id: 'bar'
+ get :show, params: { namespace_id: 'foo', id: 'bar' }
expect(response).to redirect_to(public_project)
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, public_project))
end
it 'redirects to the canonical path (testing non-show action)' do
- get :refs, namespace_id: 'foo', id: 'bar'
+ get :refs, params: { namespace_id: 'foo', id: 'bar' }
expect(response).to redirect_to(refs_project_path(public_project))
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, public_project))
@@ -714,13 +749,13 @@ describe ProjectsController do
context 'for a POST request' do
context 'when requesting the canonical path with different casing' do
it 'does not 404' do
- post :toggle_star, namespace_id: public_project.namespace, id: public_project.path.upcase
+ post :toggle_star, params: { namespace_id: public_project.namespace, id: public_project.path.upcase }
expect(response).not_to have_gitlab_http_status(404)
end
it 'does not redirect to the correct casing' do
- post :toggle_star, namespace_id: public_project.namespace, id: public_project.path.upcase
+ post :toggle_star, params: { namespace_id: public_project.namespace, id: public_project.path.upcase }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -730,7 +765,7 @@ describe ProjectsController do
let!(:redirect_route) { public_project.redirect_routes.create!(path: "foo/bar") }
it 'returns not found' do
- post :toggle_star, namespace_id: 'foo', id: 'bar'
+ post :toggle_star, params: { namespace_id: 'foo', id: 'bar' }
expect(response).to have_gitlab_http_status(404)
end
@@ -744,13 +779,13 @@ describe ProjectsController do
context 'when requesting the canonical path with different casing' do
it 'does not 404' do
- delete :destroy, namespace_id: project.namespace, id: project.path.upcase
+ delete :destroy, params: { namespace_id: project.namespace, id: project.path.upcase }
expect(response).not_to have_gitlab_http_status(404)
end
it 'does not redirect to the correct casing' do
- delete :destroy, namespace_id: project.namespace, id: project.path.upcase
+ delete :destroy, params: { namespace_id: project.namespace, id: project.path.upcase }
expect(response).not_to have_gitlab_http_status(301)
end
@@ -760,7 +795,7 @@ describe ProjectsController do
let!(:redirect_route) { project.redirect_routes.create!(path: "foo/bar") }
it 'returns not found' do
- delete :destroy, namespace_id: 'foo', id: 'bar'
+ delete :destroy, params: { namespace_id: 'foo', id: 'bar' }
expect(response).to have_gitlab_http_status(404)
end
@@ -777,7 +812,7 @@ describe ProjectsController do
context 'when project export is enabled' do
it 'returns 302' do
- get :export, namespace_id: project.namespace, id: project
+ get :export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(302)
end
@@ -789,7 +824,7 @@ describe ProjectsController do
end
it 'returns 404' do
- get :export, namespace_id: project.namespace, id: project
+ get :export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(404)
end
@@ -806,7 +841,7 @@ describe ProjectsController do
context 'object storage enabled' do
context 'when project export is enabled' do
it 'returns 302' do
- get :download_export, namespace_id: project.namespace, id: project
+ get :download_export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(302)
end
@@ -818,7 +853,7 @@ describe ProjectsController do
end
it 'returns 404' do
- get :download_export, namespace_id: project.namespace, id: project
+ get :download_export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(404)
end
@@ -835,7 +870,7 @@ describe ProjectsController do
context 'when project export is enabled' do
it 'returns 302' do
- post :remove_export, namespace_id: project.namespace, id: project
+ post :remove_export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(302)
end
@@ -847,7 +882,7 @@ describe ProjectsController do
end
it 'returns 404' do
- post :remove_export, namespace_id: project.namespace, id: project
+ post :remove_export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(404)
end
@@ -863,7 +898,7 @@ describe ProjectsController do
context 'when project export is enabled' do
it 'returns 302' do
- post :generate_new_export, namespace_id: project.namespace, id: project
+ post :generate_new_export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(302)
end
@@ -875,7 +910,7 @@ describe ProjectsController do
end
it 'returns 404' do
- post :generate_new_export, namespace_id: project.namespace, id: project
+ post :generate_new_export, params: { namespace_id: project.namespace, id: project }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index d334a2ff566..fd151e8a298 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -17,7 +17,7 @@ describe RegistrationsController do
it 'signs the user in' do
allow_any_instance_of(ApplicationSetting).to receive(:send_user_confirmation_email).and_return(false)
- expect { post(:create, user_params) }.not_to change { ActionMailer::Base.deliveries.size }
+ expect { post(:create, params: user_params) }.not_to change { ActionMailer::Base.deliveries.size }
expect(subject.current_user).not_to be_nil
end
end
@@ -26,7 +26,7 @@ describe RegistrationsController do
it 'does not authenticate user and sends confirmation email' do
allow_any_instance_of(ApplicationSetting).to receive(:send_user_confirmation_email).and_return(true)
- post(:create, user_params)
+ post(:create, params: user_params)
expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
expect(subject.current_user).to be_nil
@@ -37,7 +37,7 @@ describe RegistrationsController do
it 'redirects to sign_in' do
allow_any_instance_of(ApplicationSetting).to receive(:signup_enabled?).and_return(false)
- expect { post(:create, user_params) }.not_to change(User, :count)
+ expect { post(:create, params: user_params) }.not_to change(User, :count)
expect(response).to redirect_to(new_user_session_path)
end
end
@@ -52,7 +52,7 @@ describe RegistrationsController do
# Without this, `verify_recaptcha` arbitrarily returns true in test env
Recaptcha.configuration.skip_verify_env.delete('test')
- post(:create, user_params)
+ post(:create, params: user_params)
expect(response).to render_template(:new)
expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'
@@ -64,7 +64,7 @@ describe RegistrationsController do
Recaptcha.configuration.skip_verify_env << 'test'
end
- post(:create, user_params)
+ post(:create, params: user_params)
expect(flash[:notice]).to include 'Welcome! You have signed up successfully.'
end
@@ -76,13 +76,13 @@ describe RegistrationsController do
end
it 'redirects back with a notice when the checkbox was not checked' do
- post :create, user_params
+ post :create, params: user_params
expect(flash[:alert]).to match /you must accept our terms/i
end
it 'creates the user with agreement when terms are accepted' do
- post :create, user_params.merge(terms_opt_in: '1')
+ post :create, params: user_params.merge(terms_opt_in: '1')
expect(subject.current_user).to be_present
expect(subject.current_user.terms_accepted?).to be(true)
@@ -125,13 +125,13 @@ describe RegistrationsController do
end
it 'fails if password confirmation is wrong' do
- post :destroy, password: 'wrong password'
+ post :destroy, params: { password: 'wrong password' }
expect_password_failure
end
it 'succeeds if password is confirmed' do
- post :destroy, password: '12345678'
+ post :destroy, params: { password: '12345678' }
expect_success
end
@@ -150,13 +150,13 @@ describe RegistrationsController do
end
it 'fails if username confirmation is wrong' do
- post :destroy, username: 'wrong username'
+ post :destroy, params: { username: 'wrong username' }
expect_username_failure
end
it 'succeeds if username is confirmed' do
- post :destroy, username: user.username
+ post :destroy, params: { username: user.username }
expect_success
end
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 416a09e1684..c9b53336fd1 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -11,7 +11,7 @@ describe SearchController do
project = create(:project, :public)
note = create(:note_on_issue, project: project)
- get :show, project_id: project.id, scope: 'notes', search: note.note
+ get :show, params: { project_id: project.id, scope: 'notes', search: note.note }
expect(assigns[:search_objects].first).to eq note
end
@@ -30,13 +30,13 @@ describe SearchController do
end
it 'still blocks searches without a project_id' do
- get :show, search: 'hello'
+ get :show, params: { search: 'hello' }
expect(response).to have_gitlab_http_status(403)
end
it 'allows searches with a project_id' do
- get :show, search: 'hello', project_id: create(:project, :public).id
+ get :show, params: { search: 'hello', project_id: create(:project, :public).id }
expect(response).to have_gitlab_http_status(200)
end
@@ -52,7 +52,7 @@ describe SearchController do
project = create(:project, :public, :issues_private)
note = create(:note_on_issue, project: project)
- get :show, project_id: project.id, scope: 'notes', search: note.note
+ get :show, params: { project_id: project.id, scope: 'notes', search: note.note }
expect(assigns[:search_objects].count).to eq(0)
end
@@ -62,7 +62,7 @@ describe SearchController do
project = create(:project, :public, :merge_requests_private)
note = create(:note_on_merge_request, project: project)
- get :show, project_id: project.id, scope: 'notes', search: note.note
+ get :show, params: { project_id: project.id, scope: 'notes', search: note.note }
expect(assigns[:search_objects].count).to eq(0)
end
@@ -71,7 +71,7 @@ describe SearchController do
project = create(:project, :public, :snippets_private)
note = create(:note_on_project_snippet, project: project)
- get :show, project_id: project.id, scope: 'notes', search: note.note
+ get :show, params: { project_id: project.id, scope: 'notes', search: note.note }
expect(assigns[:search_objects].count).to eq(0)
end
diff --git a/spec/controllers/sent_notifications_controller_spec.rb b/spec/controllers/sent_notifications_controller_spec.rb
index 54a9af92f07..75c91dd8607 100644
--- a/spec/controllers/sent_notifications_controller_spec.rb
+++ b/spec/controllers/sent_notifications_controller_spec.rb
@@ -15,7 +15,7 @@ describe SentNotificationsController do
context 'when the user is not logged in' do
context 'when the force param is passed' do
before do
- get(:unsubscribe, id: sent_notification.reply_key, force: true)
+ get(:unsubscribe, params: { id: sent_notification.reply_key, force: true })
end
it 'unsubscribes the user' do
@@ -33,7 +33,7 @@ describe SentNotificationsController do
context 'when the force param is not passed' do
before do
- get(:unsubscribe, id: sent_notification.reply_key)
+ get(:unsubscribe, params: { id: sent_notification.reply_key })
end
it 'does not unsubscribe the user' do
@@ -57,7 +57,7 @@ describe SentNotificationsController do
context 'when the ID passed does not exist' do
before do
- get(:unsubscribe, id: sent_notification.reply_key.reverse)
+ get(:unsubscribe, params: { id: sent_notification.reply_key.reverse })
end
it 'does not unsubscribe the user' do
@@ -75,7 +75,7 @@ describe SentNotificationsController do
context 'when the force param is passed' do
before do
- get(:unsubscribe, id: sent_notification.reply_key, force: true)
+ get(:unsubscribe, params: { id: sent_notification.reply_key, force: true })
end
it 'unsubscribes the user' do
@@ -101,7 +101,7 @@ describe SentNotificationsController do
let(:sent_notification) { create(:sent_notification, project: project, noteable: merge_request, recipient: user) }
before do
- get(:unsubscribe, id: sent_notification.reply_key)
+ get(:unsubscribe, params: { id: sent_notification.reply_key })
end
it 'unsubscribes the user' do
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb
index c691b3f478b..ea7242c1aa8 100644
--- a/spec/controllers/sessions_controller_spec.rb
+++ b/spec/controllers/sessions_controller_spec.rb
@@ -26,7 +26,7 @@ describe SessionsController do
context 'and auto_sign_in=false param is passed' do
it 'responds with 200' do
- get(:new, auto_sign_in: 'false')
+ get(:new, params: { auto_sign_in: 'false' })
expect(response).to have_gitlab_http_status(200)
end
@@ -42,7 +42,7 @@ describe SessionsController do
context 'when using standard authentications' do
context 'invalid password' do
it 'does not authenticate user' do
- post(:create, user: { login: 'invalid', password: 'invalid' })
+ post(:create, params: { user: { login: 'invalid', password: 'invalid' } })
expect(response)
.to set_flash.now[:alert].to /Invalid Login or password/
@@ -54,19 +54,19 @@ describe SessionsController do
let(:user_params) { { login: user.username, password: user.password } }
it 'authenticates user correctly' do
- post(:create, user: user_params)
+ post(:create, params: { user: user_params })
expect(subject.current_user). to eq user
end
it 'creates an audit log record' do
- expect { post(:create, user: user_params) }.to change { SecurityEvent.count }.by(1)
+ expect { post(:create, params: { user: user_params }) }.to change { SecurityEvent.count }.by(1)
expect(SecurityEvent.last.details[:with]).to eq('standard')
end
include_examples 'user login request with unique ip limit', 302 do
def request
- post(:create, user: user_params)
+ post(:create, params: { user: user_params })
expect(subject.current_user).to eq user
subject.sign_out user
end
@@ -74,7 +74,7 @@ describe SessionsController do
it 'updates the user activity' do
expect do
- post(:create, user: user_params)
+ post(:create, params: { user: user_params })
end.to change { user.reload.last_activity_on }.to(Date.today)
end
end
@@ -98,7 +98,7 @@ describe SessionsController do
.with(:failed_login_captcha_total, anything)
.and_return(counter)
- post(:create, user: user_params)
+ post(:create, params: { user: user_params })
expect(response).to render_template(:new)
expect(flash[:alert]).to include 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.'
@@ -116,7 +116,7 @@ describe SessionsController do
.and_return(counter)
expect(Gitlab::Metrics).to receive(:counter).and_call_original
- post(:create, user: user_params)
+ post(:create, params: { user: user_params })
expect(subject.current_user).to eq user
end
@@ -127,7 +127,7 @@ describe SessionsController do
let(:user) { create(:user, :two_factor) }
def authenticate_2fa(user_params)
- post(:create, { user: user_params }, { otp_user_id: user.id })
+ post(:create, params: { user: user_params }, session: { otp_user_id: user.id })
end
context 'remember_me field' do
@@ -233,7 +233,7 @@ describe SessionsController do
end
it 'keeps the user locked on future login attempts' do
- post(:create, user: { login: user.username, password: user.password })
+ post(:create, params: { user: { login: user.username, password: user.password } })
expect(response)
.to set_flash.now[:alert].to /Invalid Login or password/
@@ -265,7 +265,7 @@ describe SessionsController do
let(:user) { create(:user, :two_factor) }
def authenticate_2fa_u2f(user_params)
- post(:create, { user: user_params }, { otp_user_id: user.id })
+ post(:create, params: { user: user_params }, session: { otp_user_id: user.id })
end
context 'remember_me field' do
@@ -309,7 +309,7 @@ describe SessionsController do
search_path = "/search?search=seed_project"
request.headers[:HTTP_REFERER] = "http://#{host}#{search_path}"
- get(:new, redirect_to_referer: :yes)
+ get(:new, params: { redirect_to_referer: :yes })
expect(controller.stored_location_for(:redirect)).to eq(search_path)
end
diff --git a/spec/controllers/snippets/notes_controller_spec.rb b/spec/controllers/snippets/notes_controller_spec.rb
index e6148ea1734..6efbd1f6c71 100644
--- a/spec/controllers/snippets/notes_controller_spec.rb
+++ b/spec/controllers/snippets/notes_controller_spec.rb
@@ -16,7 +16,7 @@ describe Snippets::NotesController do
before do
note_on_public
- get :index, { snippet_id: public_snippet }
+ get :index, params: { snippet_id: public_snippet }
end
it "returns status 200" do
@@ -35,7 +35,7 @@ describe Snippets::NotesController do
context 'when user not logged in' do
it "returns status 404" do
- get :index, { snippet_id: internal_snippet }
+ get :index, params: { snippet_id: internal_snippet }
expect(response).to have_gitlab_http_status(404)
end
@@ -47,7 +47,7 @@ describe Snippets::NotesController do
end
it "returns status 200" do
- get :index, { snippet_id: internal_snippet }
+ get :index, params: { snippet_id: internal_snippet }
expect(response).to have_gitlab_http_status(200)
end
@@ -61,7 +61,7 @@ describe Snippets::NotesController do
context 'when user not logged in' do
it "returns status 404" do
- get :index, { snippet_id: private_snippet }
+ get :index, params: { snippet_id: private_snippet }
expect(response).to have_gitlab_http_status(404)
end
@@ -73,7 +73,7 @@ describe Snippets::NotesController do
end
it "returns status 404" do
- get :index, { snippet_id: private_snippet }
+ get :index, params: { snippet_id: private_snippet }
expect(response).to have_gitlab_http_status(404)
end
@@ -87,13 +87,13 @@ describe Snippets::NotesController do
end
it "returns status 200" do
- get :index, { snippet_id: private_snippet }
+ get :index, params: { snippet_id: private_snippet }
expect(response).to have_gitlab_http_status(200)
end
it "returns 1 note" do
- get :index, { snippet_id: private_snippet }
+ get :index, params: { snippet_id: private_snippet }
expect(JSON.parse(response.body)['notes'].count).to eq(1)
end
@@ -110,7 +110,7 @@ describe Snippets::NotesController do
end
it "does not return any note" do
- get :index, { snippet_id: public_snippet }
+ get :index, params: { snippet_id: public_snippet }
expect(JSON.parse(response.body)['notes'].count).to eq(0)
end
@@ -132,13 +132,13 @@ describe Snippets::NotesController do
end
it "returns status 200" do
- delete :destroy, request_params
+ delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(200)
end
it "deletes the note" do
- expect { delete :destroy, request_params }.to change { Note.count }.from(1).to(0)
+ expect { delete :destroy, params: request_params }.to change { Note.count }.from(1).to(0)
end
context 'system note' do
@@ -147,7 +147,7 @@ describe Snippets::NotesController do
end
it "does not delete the note" do
- expect { delete :destroy, request_params }.not_to change { Note.count }
+ expect { delete :destroy, params: request_params }.not_to change { Note.count }
end
end
end
@@ -160,13 +160,13 @@ describe Snippets::NotesController do
end
it "returns status 404" do
- delete :destroy, request_params
+ delete :destroy, params: request_params
expect(response).to have_gitlab_http_status(404)
end
it "does not update the note" do
- expect { delete :destroy, request_params }.not_to change { Note.count }
+ expect { delete :destroy, params: request_params }.not_to change { Note.count }
end
end
end
@@ -177,7 +177,7 @@ describe Snippets::NotesController do
sign_in(user)
end
- subject { post(:toggle_award_emoji, snippet_id: public_snippet, id: note.id, name: "thumbsup") }
+ subject { post(:toggle_award_emoji, params: { snippet_id: public_snippet, id: note.id, name: "thumbsup" }) }
it "toggles the award emoji" do
expect { subject }.to change { note.award_emoji.count }.by(1)
diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb
index 957bab638b1..01a5161f775 100644
--- a/spec/controllers/snippets_controller_spec.rb
+++ b/spec/controllers/snippets_controller_spec.rb
@@ -8,7 +8,7 @@ describe SnippetsController do
context 'when username parameter is present' do
it 'renders snippets of a user when username is present' do
- get :index, username: user.username
+ get :index, params: { username: user.username }
expect(response).to render_template(:index)
end
@@ -67,7 +67,7 @@ describe SnippetsController do
let(:other_personal_snippet) { create(:personal_snippet, :private, author: other_author) }
it 'responds with status 404' do
- get :show, id: other_personal_snippet.to_param
+ get :show, params: { id: other_personal_snippet.to_param }
expect(response).to have_gitlab_http_status(404)
end
@@ -75,7 +75,7 @@ describe SnippetsController do
context 'when signed in user is the author' do
it 'renders the snippet' do
- get :show, id: personal_snippet.to_param
+ get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -85,7 +85,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'redirects to the sign in page' do
- get :show, id: personal_snippet.to_param
+ get :show, params: { id: personal_snippet.to_param }
expect(response).to redirect_to(new_user_session_path)
end
@@ -101,7 +101,7 @@ describe SnippetsController do
end
it 'renders the snippet' do
- get :show, id: personal_snippet.to_param
+ get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -110,7 +110,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'redirects to the sign in page' do
- get :show, id: personal_snippet.to_param
+ get :show, params: { id: personal_snippet.to_param }
expect(response).to redirect_to(new_user_session_path)
end
@@ -126,7 +126,7 @@ describe SnippetsController do
end
it 'renders the snippet' do
- get :show, id: personal_snippet.to_param
+ get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -135,7 +135,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'renders the snippet' do
- get :show, id: personal_snippet.to_param
+ get :show, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -150,7 +150,7 @@ describe SnippetsController do
end
it 'responds with status 404' do
- get :show, id: 'doesntexist'
+ get :show, params: { id: 'doesntexist' }
expect(response).to have_gitlab_http_status(404)
end
@@ -158,7 +158,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'responds with status 404' do
- get :show, id: 'doesntexist'
+ get :show, params: { id: 'doesntexist' }
expect(response).to redirect_to(new_user_session_path)
end
@@ -170,7 +170,7 @@ describe SnippetsController do
def create_snippet(snippet_params = {}, additional_params = {})
sign_in(user)
- post :create, {
+ post :create, params: {
personal_snippet: { title: 'Title', content: 'Content', description: 'Description' }.merge(snippet_params)
}.merge(additional_params)
@@ -279,7 +279,7 @@ describe SnippetsController do
def update_snippet(snippet_params = {}, additional_params = {})
sign_in(user)
- put :update, {
+ put :update, params: {
id: snippet.id,
personal_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params)
}.merge(additional_params)
@@ -406,7 +406,7 @@ describe SnippetsController do
create(:user_agent_detail, subject: snippet)
sign_in(admin)
- post :mark_as_spam, id: snippet.id
+ post :mark_as_spam, params: { id: snippet.id }
end
it 'updates the snippet' do
@@ -430,7 +430,7 @@ describe SnippetsController do
let(:other_personal_snippet) { create(:personal_snippet, :private, author: other_author) }
it 'responds with status 404' do
- get :raw, id: other_personal_snippet.to_param
+ get :raw, params: { id: other_personal_snippet.to_param }
expect(response).to have_gitlab_http_status(404)
end
@@ -441,7 +441,7 @@ describe SnippetsController do
before do
stub_feature_flags(workhorse_set_content_type: flag_value)
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
end
it 'responds with status 200' do
@@ -477,7 +477,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'redirects to the sign in page' do
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
expect(response).to redirect_to(new_user_session_path)
end
@@ -493,7 +493,7 @@ describe SnippetsController do
end
it 'responds with status 200' do
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -502,7 +502,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'redirects to the sign in page' do
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
expect(response).to redirect_to(new_user_session_path)
end
@@ -518,7 +518,7 @@ describe SnippetsController do
end
it 'responds with status 200' do
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -530,13 +530,13 @@ describe SnippetsController do
end
it 'returns LF line endings by default' do
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
expect(response.body).to eq("first line\nsecond line\nthird line")
end
it 'does not convert line endings when parameter present' do
- get :raw, id: personal_snippet.to_param, line_ending: :raw
+ get :raw, params: { id: personal_snippet.to_param, line_ending: :raw }
expect(response.body).to eq("first line\r\nsecond line\r\nthird line")
end
@@ -545,7 +545,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'responds with status 200' do
- get :raw, id: personal_snippet.to_param
+ get :raw, params: { id: personal_snippet.to_param }
expect(assigns(:snippet)).to eq(personal_snippet)
expect(response).to have_gitlab_http_status(200)
@@ -560,7 +560,7 @@ describe SnippetsController do
end
it 'responds with status 404' do
- get :raw, id: 'doesntexist'
+ get :raw, params: { id: 'doesntexist' }
expect(response).to have_gitlab_http_status(404)
end
@@ -568,7 +568,7 @@ describe SnippetsController do
context 'when not signed in' do
it 'redirects to the sign in path' do
- get :raw, id: 'doesntexist'
+ get :raw, params: { id: 'doesntexist' }
expect(response).to redirect_to(new_user_session_path)
end
@@ -587,17 +587,17 @@ describe SnippetsController do
describe 'POST #toggle_award_emoji' do
it "toggles the award emoji" do
expect do
- post(:toggle_award_emoji, id: personal_snippet.to_param, name: "thumbsup")
+ post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" })
end.to change { personal_snippet.award_emoji.count }.from(0).to(1)
expect(response.status).to eq(200)
end
it "removes the already awarded emoji" do
- post(:toggle_award_emoji, id: personal_snippet.to_param, name: "thumbsup")
+ post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" })
expect do
- post(:toggle_award_emoji, id: personal_snippet.to_param, name: "thumbsup")
+ post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" })
end.to change { personal_snippet.award_emoji.count }.from(1).to(0)
expect(response.status).to eq(200)
@@ -611,7 +611,7 @@ describe SnippetsController do
it 'renders json in a correct format' do
sign_in(user)
- post :preview_markdown, id: snippet, text: '*Markdown* text'
+ post :preview_markdown, params: { id: snippet, text: '*Markdown* text' }
expect(JSON.parse(response.body).keys).to match_array(%w(body references))
end
diff --git a/spec/controllers/uploads_controller_spec.rb b/spec/controllers/uploads_controller_spec.rb
index 832649e5886..19142aa1272 100644
--- a/spec/controllers/uploads_controller_spec.rb
+++ b/spec/controllers/uploads_controller_spec.rb
@@ -23,7 +23,7 @@ describe UploadsController do
context 'when a user does not have permissions to upload a file' do
it "returns 401 when the user is not logged in" do
- post :create, model: model, id: snippet.id, format: :json
+ post :create, params: { model: model, id: snippet.id }, format: :json
expect(response).to have_gitlab_http_status(401)
end
@@ -32,7 +32,7 @@ describe UploadsController do
private_snippet = create(:personal_snippet, :private)
sign_in(user)
- post :create, model: model, id: private_snippet.id, format: :json
+ post :create, params: { model: model, id: private_snippet.id }, format: :json
expect(response).to have_gitlab_http_status(404)
end
@@ -44,25 +44,25 @@ describe UploadsController do
end
it "returns an error without file" do
- post :create, model: model, id: snippet.id, format: :json
+ post :create, params: { model: model, id: snippet.id }, format: :json
expect(response).to have_gitlab_http_status(422)
end
it "returns an error with invalid model" do
- expect { post :create, model: 'invalid', id: snippet.id, format: :json }
+ expect { post :create, params: { model: 'invalid', id: snippet.id }, format: :json }
.to raise_error(ActionController::UrlGenerationError)
end
it "returns 404 status when object not found" do
- post :create, model: model, id: 9999, format: :json
+ post :create, params: { model: model, id: 9999 }, format: :json
expect(response).to have_gitlab_http_status(404)
end
context 'with valid image' do
before do
- post :create, model: 'personal_snippet', id: snippet.id, file: jpg, format: :json
+ post :create, params: { model: 'personal_snippet', id: snippet.id, file: jpg }, format: :json
end
it 'returns a content with original filename, new link, and correct type.' do
@@ -82,7 +82,7 @@ describe UploadsController do
context 'with valid non-image file' do
before do
- post :create, model: 'personal_snippet', id: snippet.id, file: txt, format: :json
+ post :create, params: { model: 'personal_snippet', id: snippet.id, file: txt }, format: :json
end
it 'returns a content with original filename, new link, and correct type.' do
@@ -102,7 +102,7 @@ describe UploadsController do
context 'temporal with valid image' do
subject do
- post :create, model: 'personal_snippet', file: jpg, format: :json
+ post :create, params: { model: 'personal_snippet', file: jpg }, format: :json
end
it 'returns a content with original filename, new link, and correct type.' do
@@ -119,7 +119,7 @@ describe UploadsController do
context 'temporal with valid non-image file' do
subject do
- post :create, model: 'personal_snippet', file: txt, format: :json
+ post :create, params: { model: 'personal_snippet', file: txt }, format: :json
end
it 'returns a content with original filename, new link, and correct type.' do
@@ -143,7 +143,7 @@ describe UploadsController do
context 'for PNG files' do
it 'returns Content-Disposition: inline' do
note = create(:note, :with_attachment, project: project)
- get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png'
+ get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
expect(response['Content-Disposition']).to start_with('inline;')
end
@@ -152,7 +152,7 @@ describe UploadsController do
context 'for SVG files' do
it 'returns Content-Disposition: attachment' do
note = create(:note, :with_svg_attachment, project: project)
- get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'unsanitized.svg'
+ get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'unsanitized.svg' }
expect(response['Content-Disposition']).to start_with('attachment;')
end
@@ -171,7 +171,7 @@ describe UploadsController do
end
it "redirects to the sign in page" do
- get :show, model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png"
+ get :show, params: { model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png" }
expect(response).to redirect_to(new_user_session_path)
end
@@ -179,14 +179,14 @@ describe UploadsController do
context "when the user isn't blocked" do
it "responds with status 200" do
- get :show, model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png"
+ get :show, params: { model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'user', mounted_as: 'avatar', id: user.id, filename: 'dk.png'
+ get :show, params: { model: 'user', mounted_as: 'avatar', id: user.id, filename: 'dk.png' }
response
end
@@ -196,14 +196,14 @@ describe UploadsController do
context "when not signed in" do
it "responds with status 200" do
- get :show, model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png"
+ get :show, params: { model: "user", mounted_as: "avatar", id: user.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
- get :show, model: 'user', mounted_as: 'avatar', id: user.id, filename: 'dk.png'
+ get :show, params: { model: 'user', mounted_as: 'avatar', id: user.id, filename: 'dk.png' }
response
end
@@ -221,14 +221,14 @@ describe UploadsController do
context "when not signed in" do
it "responds with status 200" do
- get :show, model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png"
+ get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
- get :show, model: 'project', mounted_as: 'avatar', id: project.id, filename: 'dk.png'
+ get :show, params: { model: 'project', mounted_as: 'avatar', id: project.id, filename: 'dk.png' }
response
end
@@ -241,14 +241,14 @@ describe UploadsController do
end
it "responds with status 200" do
- get :show, model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png"
+ get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'project', mounted_as: 'avatar', id: project.id, filename: 'dk.png'
+ get :show, params: { model: 'project', mounted_as: 'avatar', id: project.id, filename: 'dk.png' }
response
end
@@ -263,7 +263,7 @@ describe UploadsController do
context "when not signed in" do
it "redirects to the sign in page" do
- get :show, model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png"
+ get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
expect(response).to redirect_to(new_user_session_path)
end
@@ -286,7 +286,7 @@ describe UploadsController do
end
it "redirects to the sign in page" do
- get :show, model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png"
+ get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
expect(response).to redirect_to(new_user_session_path)
end
@@ -294,14 +294,14 @@ describe UploadsController do
context "when the user isn't blocked" do
it "responds with status 200" do
- get :show, model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png"
+ get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'project', mounted_as: 'avatar', id: project.id, filename: 'dk.png'
+ get :show, params: { model: 'project', mounted_as: 'avatar', id: project.id, filename: 'dk.png' }
response
end
@@ -311,7 +311,7 @@ describe UploadsController do
context "when the user doesn't have access to the project" do
it "responds with status 404" do
- get :show, model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png"
+ get :show, params: { model: "project", mounted_as: "avatar", id: project.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(404)
end
@@ -326,14 +326,14 @@ describe UploadsController do
context "when the group is public" do
context "when not signed in" do
it "responds with status 200" do
- get :show, model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png"
+ get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
- get :show, model: 'group', mounted_as: 'avatar', id: group.id, filename: 'dk.png'
+ get :show, params: { model: 'group', mounted_as: 'avatar', id: group.id, filename: 'dk.png' }
response
end
@@ -346,14 +346,14 @@ describe UploadsController do
end
it "responds with status 200" do
- get :show, model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png"
+ get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'group', mounted_as: 'avatar', id: group.id, filename: 'dk.png'
+ get :show, params: { model: 'group', mounted_as: 'avatar', id: group.id, filename: 'dk.png' }
response
end
@@ -382,7 +382,7 @@ describe UploadsController do
end
it "redirects to the sign in page" do
- get :show, model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png"
+ get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
expect(response).to redirect_to(new_user_session_path)
end
@@ -390,14 +390,14 @@ describe UploadsController do
context "when the user isn't blocked" do
it "responds with status 200" do
- get :show, model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png"
+ get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'group', mounted_as: 'avatar', id: group.id, filename: 'dk.png'
+ get :show, params: { model: 'group', mounted_as: 'avatar', id: group.id, filename: 'dk.png' }
response
end
@@ -407,7 +407,7 @@ describe UploadsController do
context "when the user doesn't have access to the project" do
it "responds with status 404" do
- get :show, model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png"
+ get :show, params: { model: "group", mounted_as: "avatar", id: group.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(404)
end
@@ -427,14 +427,14 @@ describe UploadsController do
context "when not signed in" do
it "responds with status 200" do
- get :show, model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png"
+ get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
- get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png'
+ get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
response
end
@@ -447,14 +447,14 @@ describe UploadsController do
end
it "responds with status 200" do
- get :show, model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png"
+ get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png'
+ get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
response
end
@@ -469,7 +469,7 @@ describe UploadsController do
context "when not signed in" do
it "redirects to the sign in page" do
- get :show, model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png"
+ get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
expect(response).to redirect_to(new_user_session_path)
end
@@ -492,7 +492,7 @@ describe UploadsController do
end
it "redirects to the sign in page" do
- get :show, model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png"
+ get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
expect(response).to redirect_to(new_user_session_path)
end
@@ -500,14 +500,14 @@ describe UploadsController do
context "when the user isn't blocked" do
it "responds with status 200" do
- get :show, model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png"
+ get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation and no-store' do
subject do
- get :show, model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png'
+ get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
response
end
@@ -517,7 +517,7 @@ describe UploadsController do
context "when the user doesn't have access to the project" do
it "responds with status 404" do
- get :show, model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png"
+ get :show, params: { model: "note", mounted_as: "attachment", id: note.id, filename: "dk.png" }
expect(response).to have_gitlab_http_status(404)
end
@@ -532,14 +532,14 @@ describe UploadsController do
context 'when not signed in' do
it 'responds with status 200' do
- get :show, model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png'
+ get :show, params: { model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png' }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
- get :show, model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png'
+ get :show, params: { model: 'appearance', mounted_as: 'header_logo', id: appearance.id, filename: 'dk.png' }
response
end
@@ -552,14 +552,14 @@ describe UploadsController do
context 'when not signed in' do
it 'responds with status 200' do
- get :show, model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png'
+ get :show, params: { model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png' }
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content not cached without revalidation' do
subject do
- get :show, model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png'
+ get :show, params: { model: 'appearance', mounted_as: 'logo', id: appearance.id, filename: 'dk.png' }
response
end
@@ -573,7 +573,7 @@ describe UploadsController do
context 'has a valid filename on the original file' do
it 'successfully returns the file' do
- get :show, model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'dk.png'
+ get :show, params: { model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'dk.png' }
expect(response).to have_gitlab_http_status(200)
expect(response.header['Content-Disposition']).to end_with 'filename="dk.png"'
@@ -582,7 +582,7 @@ describe UploadsController do
context 'has an invalid filename on the original file' do
it 'returns a 404' do
- get :show, model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'bogus.png'
+ get :show, params: { model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'bogus.png' }
expect(response).to have_gitlab_http_status(404)
end
diff --git a/spec/controllers/user_callouts_controller_spec.rb b/spec/controllers/user_callouts_controller_spec.rb
index 48e2ff75cac..c71d75a3e7f 100644
--- a/spec/controllers/user_callouts_controller_spec.rb
+++ b/spec/controllers/user_callouts_controller_spec.rb
@@ -8,7 +8,7 @@ describe UserCalloutsController do
end
describe "POST #create" do
- subject { post :create, feature_name: feature_name, format: :json }
+ subject { post :create, params: { feature_name: feature_name }, format: :json }
context 'with valid feature name' do
let(:feature_name) { UserCallout.feature_names.keys.first }
diff --git a/spec/controllers/users/terms_controller_spec.rb b/spec/controllers/users/terms_controller_spec.rb
index 0d77e91a67d..cbfd2b17864 100644
--- a/spec/controllers/users/terms_controller_spec.rb
+++ b/spec/controllers/users/terms_controller_spec.rb
@@ -40,7 +40,7 @@ describe Users::TermsController do
describe 'POST #accept' do
it 'saves that the user accepted the terms' do
- post :accept, id: term.id
+ post :accept, params: { id: term.id }
agreement = user.term_agreements.find_by(term: term)
@@ -48,7 +48,7 @@ describe Users::TermsController do
end
it 'redirects to a path when specified' do
- post :accept, id: term.id, redirect: groups_path
+ post :accept, params: { id: term.id, redirect: groups_path }
expect(response).to redirect_to(groups_path)
end
@@ -56,14 +56,14 @@ describe Users::TermsController do
it 'redirects to the referer when no redirect specified' do
request.env["HTTP_REFERER"] = groups_url
- post :accept, id: term.id
+ post :accept, params: { id: term.id }
expect(response).to redirect_to(groups_path)
end
context 'redirecting to another domain' do
it 'is prevented when passing a redirect param' do
- post :accept, id: term.id, redirect: '//example.com/random/path'
+ post :accept, params: { id: term.id, redirect: '//example.com/random/path' }
expect(response).to redirect_to(root_path)
end
@@ -71,7 +71,7 @@ describe Users::TermsController do
it 'is prevented when redirecting to the referer' do
request.env["HTTP_REFERER"] = 'http://example.com/and/a/path'
- post :accept, id: term.id
+ post :accept, params: { id: term.id }
expect(response).to redirect_to(root_path)
end
@@ -80,7 +80,7 @@ describe Users::TermsController do
describe 'POST #decline' do
it 'stores that the user declined the terms' do
- post :decline, id: term.id
+ post :decline, params: { id: term.id }
agreement = user.term_agreements.find_by(term: term)
@@ -88,7 +88,7 @@ describe Users::TermsController do
end
it 'signs out the user' do
- post :decline, id: term.id
+ post :decline, params: { id: term.id }
expect(response).to redirect_to(root_path)
expect(assigns(:current_user)).to be_nil
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index fe438e71e9e..27edf226ca3 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -15,7 +15,7 @@ describe UsersController do
end
it 'renders the show template' do
- get :show, username: user.username
+ get :show, params: { username: user.username }
expect(response).to be_success
expect(response).to render_template('show')
@@ -24,7 +24,7 @@ describe UsersController do
describe 'when logged out' do
it 'renders the show template' do
- get :show, username: user.username
+ get :show, params: { username: user.username }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('show')
@@ -39,7 +39,7 @@ describe UsersController do
context 'when logged out' do
it 'redirects to login page' do
- get :show, username: user.username
+ get :show, params: { username: user.username }
expect(response).to redirect_to new_user_session_path
end
end
@@ -50,7 +50,7 @@ describe UsersController do
end
it 'renders show' do
- get :show, username: user.username
+ get :show, params: { username: user.username }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('show')
end
@@ -60,7 +60,7 @@ describe UsersController do
context 'when a user by that username does not exist' do
context 'when logged out' do
it 'redirects to login page' do
- get :show, username: 'nonexistent'
+ get :show, params: { username: 'nonexistent' }
expect(response).to redirect_to new_user_session_path
end
end
@@ -71,7 +71,7 @@ describe UsersController do
end
it 'renders 404' do
- get :show, username: 'nonexistent'
+ get :show, params: { username: 'nonexistent' }
expect(response).to have_gitlab_http_status(404)
end
end
@@ -87,7 +87,7 @@ describe UsersController do
end
it 'loads events' do
- get :show, username: user, format: :json
+ get :show, params: { username: user }, format: :json
expect(assigns(:events)).not_to be_empty
end
@@ -96,7 +96,7 @@ describe UsersController do
allow(Ability).to receive(:allowed?).and_call_original
expect(Ability).to receive(:allowed?).with(user, :read_cross_project) { false }
- get :show, username: user, format: :json
+ get :show, params: { username: user }, format: :json
expect(assigns(:events)).to be_empty
end
@@ -104,7 +104,7 @@ describe UsersController do
it 'hides events if the user has a private profile' do
Gitlab::DataBuilder::Push.build_sample(project, private_user)
- get :show, username: private_user.username, format: :json
+ get :show, params: { username: private_user.username }, format: :json
expect(assigns(:events)).to be_empty
end
@@ -125,7 +125,7 @@ describe UsersController do
push_data = Gitlab::DataBuilder::Push.build_sample(project, public_user)
EventCreateService.new.push(project, public_user, push_data)
- get :calendar, username: public_user.username, format: :json
+ get :calendar, params: { username: public_user.username }, format: :json
expect(response).to have_gitlab_http_status(200)
end
@@ -136,7 +136,7 @@ describe UsersController do
push_data = Gitlab::DataBuilder::Push.build_sample(project, private_user)
EventCreateService.new.push(project, private_user, push_data)
- get :calendar, username: private_user.username, format: :json
+ get :calendar, params: { username: private_user.username }, format: :json
expect(response).to have_gitlab_http_status(:not_found)
end
@@ -161,7 +161,7 @@ describe UsersController do
end
it 'includes forked projects' do
- get :calendar, username: user.username
+ get :calendar, params: { username: user.username }
expect(assigns(:contributions_calendar).projects.count).to eq(2)
end
end
@@ -179,7 +179,7 @@ describe UsersController do
end
it 'assigns @calendar_date' do
- get :calendar_activities, username: user.username, date: '2014-07-31'
+ get :calendar_activities, params: { username: user.username, date: '2014-07-31' }
expect(assigns(:calendar_date)).to eq(Date.parse('2014-07-31'))
end
@@ -189,7 +189,7 @@ describe UsersController do
push_data = Gitlab::DataBuilder::Push.build_sample(project, public_user)
EventCreateService.new.push(project, public_user, push_data)
- get :calendar_activities, username: public_user.username
+ get :calendar_activities, params: { username: public_user.username }
expect(assigns[:events]).not_to be_empty
end
end
@@ -199,7 +199,7 @@ describe UsersController do
push_data = Gitlab::DataBuilder::Push.build_sample(project, private_user)
EventCreateService.new.push(project, private_user, push_data)
- get :calendar_activities, username: private_user.username
+ get :calendar_activities, params: { username: private_user.username }
expect(response).to have_gitlab_http_status(:not_found)
end
end
@@ -213,7 +213,7 @@ describe UsersController do
context 'format html' do
it 'renders snippets page' do
- get :snippets, username: user.username
+ get :snippets, params: { username: user.username }
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template('show')
end
@@ -221,7 +221,7 @@ describe UsersController do
context 'format json' do
it 'response with snippets json data' do
- get :snippets, username: user.username, format: :json
+ get :snippets, params: { username: user.username }, format: :json
expect(response).to have_gitlab_http_status(200)
expect(JSON.parse(response.body)).to have_key('html')
end
@@ -235,7 +235,7 @@ describe UsersController do
context 'when user exists' do
it 'returns JSON indicating the user exists' do
- get :exists, username: user.username
+ get :exists, params: { username: user.username }
expected_json = { exists: true }.to_json
expect(response.body).to eq(expected_json)
@@ -245,7 +245,7 @@ describe UsersController do
let(:user) { create(:user, username: 'CamelCaseUser') }
it 'returns JSON indicating the user exists' do
- get :exists, username: user.username.downcase
+ get :exists, params: { username: user.username.downcase }
expected_json = { exists: true }.to_json
expect(response.body).to eq(expected_json)
@@ -255,7 +255,7 @@ describe UsersController do
context 'when the user does not exist' do
it 'returns JSON indicating the user does not exist' do
- get :exists, username: 'foo'
+ get :exists, params: { username: 'foo' }
expected_json = { exists: false }.to_json
expect(response.body).to eq(expected_json)
@@ -265,7 +265,7 @@ describe UsersController do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-username') }
it 'returns JSON indicating a user by that username does not exist' do
- get :exists, username: 'old-username'
+ get :exists, params: { username: 'old-username' }
expected_json = { exists: false }.to_json
expect(response.body).to eq(expected_json)
@@ -286,7 +286,7 @@ describe UsersController do
context 'with exactly matching casing' do
it 'responds with success' do
- get :show, username: user.username
+ get :show, params: { username: user.username }
expect(response).to be_success
end
@@ -294,7 +294,7 @@ describe UsersController do
context 'with different casing' do
it 'redirects to the correct casing' do
- get :show, username: user.username.downcase
+ get :show, params: { username: user.username.downcase }
expect(response).to redirect_to(user)
expect(controller).not_to set_flash[:notice]
@@ -306,7 +306,7 @@ describe UsersController do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-path') }
it 'redirects to the canonical path' do
- get :show, username: redirect_route.path
+ get :show, params: { username: redirect_route.path }
expect(response).to redirect_to(user)
expect(controller).to set_flash[:notice].to(user_moved_message(redirect_route, user))
@@ -316,7 +316,7 @@ describe UsersController do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'http') }
it 'does not modify the requested host' do
- get :show, username: redirect_route.path
+ get :show, params: { username: redirect_route.path }
expect(response).to redirect_to(user)
expect(controller).to set_flash[:notice].to(user_moved_message(redirect_route, user))
@@ -327,7 +327,7 @@ describe UsersController do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'ser') }
it 'redirects to the canonical path' do
- get :show, username: redirect_route.path
+ get :show, params: { username: redirect_route.path }
expect(response).to redirect_to(user)
expect(controller).to set_flash[:notice].to(user_moved_message(redirect_route, user))
@@ -342,7 +342,7 @@ describe UsersController do
context 'with exactly matching casing' do
it 'responds with success' do
- get :projects, username: user.username
+ get :projects, params: { username: user.username }
expect(response).to be_success
end
@@ -350,7 +350,7 @@ describe UsersController do
context 'with different casing' do
it 'redirects to the correct casing' do
- get :projects, username: user.username.downcase
+ get :projects, params: { username: user.username.downcase }
expect(response).to redirect_to(user_projects_path(user))
expect(controller).not_to set_flash[:notice]
@@ -362,7 +362,7 @@ describe UsersController do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'old-path') }
it 'redirects to the canonical path' do
- get :projects, username: redirect_route.path
+ get :projects, params: { username: redirect_route.path }
expect(response).to redirect_to(user_projects_path(user))
expect(controller).to set_flash[:notice].to(user_moved_message(redirect_route, user))
@@ -372,7 +372,7 @@ describe UsersController do
let(:redirect_route) { user.namespace.redirect_routes.create(path: 'http') }
it 'does not modify the requested host' do
- get :projects, username: redirect_route.path
+ get :projects, params: { username: redirect_route.path }
expect(response).to redirect_to(user_projects_path(user))
expect(controller).to set_flash[:notice].to(user_moved_message(redirect_route, user))
@@ -384,7 +384,7 @@ describe UsersController do
# I.e. /users/ser should not become /ufoos/ser
it 'does not modify the /users part of the path' do
- get :projects, username: redirect_route.path
+ get :projects, params: { username: redirect_route.path }
expect(response).to redirect_to(user_projects_path(user))
expect(controller).to set_flash[:notice].to(user_moved_message(redirect_route, user))