Commit b44a2c80 authored by blackst0ne's avatar blackst0ne

Update specs to rails5 format

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 }`
parent 5d68c237
...@@ -8,7 +8,7 @@ require: ...@@ -8,7 +8,7 @@ require:
- rubocop-rspec - rubocop-rspec
AllCops: AllCops:
TargetRailsVersion: 4.2 TargetRailsVersion: 5.0
Exclude: Exclude:
- 'vendor/**/*' - 'vendor/**/*'
- 'node_modules/**/*' - 'node_modules/**/*'
......
---
title: "[Rails5.1] Update functional specs to use new keyword format"
merge_request: 23095
author: "@blackst0ne"
type: other
...@@ -19,7 +19,7 @@ describe AbuseReportsController do ...@@ -19,7 +19,7 @@ describe AbuseReportsController do
user_id = user.id user_id = user.id
user.destroy user.destroy
get :new, { user_id: user_id } get :new, params: { user_id: user_id }
expect(response).to redirect_to root_path expect(response).to redirect_to root_path
expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.') expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.')
...@@ -30,7 +30,7 @@ describe AbuseReportsController do ...@@ -30,7 +30,7 @@ describe AbuseReportsController do
it 'redirects the reporter to the user\'s profile' do it 'redirects the reporter to the user\'s profile' do
user.block user.block
get :new, { user_id: user.id } get :new, params: { user_id: user.id }
expect(response).to redirect_to user expect(response).to redirect_to user
expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.') expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.')
...@@ -42,18 +42,18 @@ describe AbuseReportsController do ...@@ -42,18 +42,18 @@ describe AbuseReportsController do
context 'with valid attributes' do context 'with valid attributes' do
it 'saves the abuse report' do it 'saves the abuse report' do
expect do expect do
post :create, abuse_report: attrs post :create, params: { abuse_report: attrs }
end.to change { AbuseReport.count }.by(1) end.to change { AbuseReport.count }.by(1)
end end
it 'calls notify' do it 'calls notify' do
expect_any_instance_of(AbuseReport).to receive(:notify) expect_any_instance_of(AbuseReport).to receive(:notify)
post :create, abuse_report: attrs post :create, params: { abuse_report: attrs }
end end
it 'redirects back to the reported user' do 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 expect(response).to redirect_to user
end end
...@@ -62,7 +62,7 @@ describe AbuseReportsController do ...@@ -62,7 +62,7 @@ describe AbuseReportsController do
context 'with invalid attributes' do context 'with invalid attributes' do
it 'renders new' do it 'renders new' do
attrs.delete(:user_id) attrs.delete(:user_id)
post :create, abuse_report: attrs post :create, params: { abuse_report: attrs }
expect(response).to render_template(:new) expect(response).to render_template(:new)
end end
......
...@@ -52,35 +52,35 @@ describe Admin::ApplicationSettingsController do ...@@ -52,35 +52,35 @@ describe Admin::ApplicationSettingsController do
end end
it 'updates the password_authentication_enabled_for_git setting' do 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(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.password_authentication_enabled_for_git).to eq(false) expect(ApplicationSetting.current.password_authentication_enabled_for_git).to eq(false)
end end
it 'updates the default_project_visibility for string value' do 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(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.default_project_visibility).to eq(Gitlab::VisibilityLevel::PUBLIC) expect(ApplicationSetting.current.default_project_visibility).to eq(Gitlab::VisibilityLevel::PUBLIC)
end end
it 'update the restricted levels for string values' do 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(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.restricted_visibility_levels).to eq([10, 20]) expect(ApplicationSetting.current.restricted_visibility_levels).to eq([10, 20])
end end
it 'updates the restricted_visibility_levels when empty array is passed' do 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(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty
end end
it 'updates the receive_max_input_size setting' do 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(response).to redirect_to(admin_application_settings_path)
expect(ApplicationSetting.current.receive_max_input_size).to eq(1024) expect(ApplicationSetting.current.receive_max_input_size).to eq(1024)
......
...@@ -19,7 +19,7 @@ describe Admin::ApplicationsController do ...@@ -19,7 +19,7 @@ describe Admin::ApplicationsController do
describe 'GET #edit' do describe 'GET #edit' do
it 'renders the application form' 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(response).to render_template :edit
expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes) expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes)
...@@ -31,7 +31,7 @@ describe Admin::ApplicationsController do ...@@ -31,7 +31,7 @@ describe Admin::ApplicationsController do
create_params = attributes_for(:application, trusted: true) create_params = attributes_for(:application, trusted: true)
expect do expect do
post :create, doorkeeper_application: create_params post :create, params: { doorkeeper_application: create_params }
end.to change { Doorkeeper::Application.count }.by(1) end.to change { Doorkeeper::Application.count }.by(1)
application = Doorkeeper::Application.last application = Doorkeeper::Application.last
...@@ -42,7 +42,7 @@ describe Admin::ApplicationsController do ...@@ -42,7 +42,7 @@ describe Admin::ApplicationsController do
it 'renders the application form on errors' do it 'renders the application form on errors' do
expect 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 } end.not_to change { Doorkeeper::Application.count }
expect(response).to render_template :new expect(response).to render_template :new
...@@ -52,7 +52,7 @@ describe Admin::ApplicationsController do ...@@ -52,7 +52,7 @@ describe Admin::ApplicationsController do
describe 'PATCH #update' do describe 'PATCH #update' do
it 'updates the application' 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 application.reload
...@@ -61,7 +61,7 @@ describe Admin::ApplicationsController do ...@@ -61,7 +61,7 @@ describe Admin::ApplicationsController do
end end
it 'renders the application form on errors' do 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(response).to render_template :edit
expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes) expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes)
......
...@@ -12,12 +12,12 @@ describe Admin::GroupsController do ...@@ -12,12 +12,12 @@ describe Admin::GroupsController do
describe 'DELETE #destroy' do describe 'DELETE #destroy' do
it 'schedules a group destroy' do it 'schedules a group destroy' do
Sidekiq::Testing.fake! 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
end end
it 'redirects to the admin group path' do 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) expect(response).to redirect_to(admin_groups_path)
end end
...@@ -27,9 +27,11 @@ describe Admin::GroupsController do ...@@ -27,9 +27,11 @@ describe Admin::GroupsController do
let(:group_user) { create(:user) } let(:group_user) { create(:user) }
it 'adds user to members' do it 'adds user to members' do
put :members_update, id: group, put :members_update, params: {
user_ids: group_user.id, id: group,
access_level: Gitlab::Access::GUEST user_ids: group_user.id,
access_level: Gitlab::Access::GUEST
}
expect(response).to set_flash.to 'Users were successfully added.' expect(response).to set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(admin_group_path(group)) expect(response).to redirect_to(admin_group_path(group))
...@@ -37,18 +39,22 @@ describe Admin::GroupsController do ...@@ -37,18 +39,22 @@ describe Admin::GroupsController do
end end
it 'can add unlimited members' do it 'can add unlimited members' do
put :members_update, id: group, put :members_update, params: {
user_ids: 1.upto(1000).to_a.join(','), id: group,
access_level: Gitlab::Access::GUEST 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 set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(admin_group_path(group)) expect(response).to redirect_to(admin_group_path(group))
end end
it 'adds no user to members' do it 'adds no user to members' do
put :members_update, id: group, put :members_update, params: {
user_ids: '', id: group,
access_level: Gitlab::Access::GUEST user_ids: '',
access_level: Gitlab::Access::GUEST
}
expect(response).to set_flash.to 'No users specified.' expect(response).to set_flash.to 'No users specified.'
expect(response).to redirect_to(admin_group_path(group)) expect(response).to redirect_to(admin_group_path(group))
......
...@@ -20,7 +20,7 @@ describe Admin::HooksController do ...@@ -20,7 +20,7 @@ describe Admin::HooksController do
merge_requests_events: true merge_requests_events: true
} }
post :create, hook: hook_params post :create, params: { hook: hook_params }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
expect(SystemHook.all.size).to eq(1) expect(SystemHook.all.size).to eq(1)
......
...@@ -13,7 +13,7 @@ describe Admin::IdentitiesController do ...@@ -13,7 +13,7 @@ describe Admin::IdentitiesController do
it 'repairs ldap blocks' do it 'repairs ldap blocks' do
expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute) 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
end end
...@@ -23,7 +23,7 @@ describe Admin::IdentitiesController do ...@@ -23,7 +23,7 @@ describe Admin::IdentitiesController do
it 'repairs ldap blocks' do it 'repairs ldap blocks' do
expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute) 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 end
end end
...@@ -11,13 +11,13 @@ describe Admin::ProjectsController do ...@@ -11,13 +11,13 @@ describe Admin::ProjectsController do
render_views render_views
it 'retrieves the project for the given visibility level' do 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) expect(response.body).to match(project.name)
end end
it 'does not retrieve the project' do 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) expect(response.body).not_to match(project.name)
end end
...@@ -47,7 +47,7 @@ describe Admin::ProjectsController do ...@@ -47,7 +47,7 @@ describe Admin::ProjectsController do
render_views render_views
it 'renders show page' do 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).to have_gitlab_http_status(200)
expect(response.body).to match(project.name) expect(response.body).to match(project.name)
......
...@@ -17,13 +17,13 @@ describe Admin::RunnersController do ...@@ -17,13 +17,13 @@ describe Admin::RunnersController do
describe '#show' do describe '#show' do
it 'shows a particular runner' 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) expect(response).to have_gitlab_http_status(200)
end end
it 'shows 404 for unknown runner' do it 'shows 404 for unknown runner' do
get :show, id: 0 get :show, params: { id: 0 }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -34,7 +34,7 @@ describe Admin::RunnersController do ...@@ -34,7 +34,7 @@ describe Admin::RunnersController do
new_desc = runner.description.swapcase new_desc = runner.description.swapcase
expect do 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 } end.to change { runner.ensure_runner_queue_value }
runner.reload runner.reload
...@@ -46,7 +46,7 @@ describe Admin::RunnersController do ...@@ -46,7 +46,7 @@ describe Admin::RunnersController do
describe '#destroy' do describe '#destroy' do
it 'destroys the runner' 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(response).to have_gitlab_http_status(302)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil expect(Ci::Runner.find_by(id: runner.id)).to be_nil
...@@ -58,7 +58,7 @@ describe Admin::RunnersController do ...@@ -58,7 +58,7 @@ describe Admin::RunnersController do
runner.update(active: false) runner.update(active: false)
expect do expect do
post :resume, id: runner.id post :resume, params: { id: runner.id }
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
runner.reload runner.reload
...@@ -73,7 +73,7 @@ describe Admin::RunnersController do ...@@ -73,7 +73,7 @@ describe Admin::RunnersController do
runner.update(active: true) runner.update(active: true)
expect do expect do
post :pause, id: runner.id post :pause, params: { id: runner.id }
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
runner.reload runner.reload
......
...@@ -18,7 +18,7 @@ describe Admin::ServicesController do ...@@ -18,7 +18,7 @@ describe Admin::ServicesController do
end end
it 'successfully displays the template' do 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -44,7 +44,7 @@ describe Admin::ServicesController do ...@@ -44,7 +44,7 @@ describe Admin::ServicesController do
it 'calls the propagation worker when service is active' do it 'calls the propagation worker when service is active' do
expect(PropagateServiceTemplateWorker).to receive(:perform_async).with(service.id) 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) expect(response).to have_gitlab_http_status(302)
end end
...@@ -52,7 +52,7 @@ describe Admin::ServicesController do ...@@ -52,7 +52,7 @@ describe Admin::ServicesController do
it 'does not call the propagation worker when service is not active' do it 'does not call the propagation worker when service is not active' do
expect(PropagateServiceTemplateWorker).not_to receive(:perform_async) 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) expect(response).to have_gitlab_http_status(302)
end end
......
...@@ -20,13 +20,13 @@ describe Admin::SpamLogsController do ...@@ -20,13 +20,13 @@ describe Admin::SpamLogsController do
describe '#destroy' do describe '#destroy' do
it 'removes only the spam log when removing log' 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(User.find(user.id)).to be_truthy
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
it 'removes user and his spam logs when removing the user' do 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(flash[:notice]).to eq "User #{user.username} was successfully removed."
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -40,7 +40,7 @@ describe Admin::SpamLogsController do ...@@ -40,7 +40,7 @@ describe Admin::SpamLogsController do
allow_any_instance_of(AkismetService).to receive(:submit_ham).and_return(true) allow_any_instance_of(AkismetService).to receive(:submit_ham).and_return(true)
end end
it 'submits the log as ham' do 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(response).to have_gitlab_http_status(302)
expect(SpamLog.find(first_spam.id).submitted_as_ham).to be_truthy expect(SpamLog.find(first_spam.id).submitted_as_ham).to be_truthy
......
...@@ -17,7 +17,7 @@ describe Admin::UsersController do ...@@ -17,7 +17,7 @@ describe Admin::UsersController do
end end
it 'deletes user and ghosts their contributions' do 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(response).to have_gitlab_http_status(200)
expect(User.exists?(user.id)).to be_falsy expect(User.exists?(user.id)).to be_falsy
...@@ -25,7 +25,7 @@ describe Admin::UsersController do ...@@ -25,7 +25,7 @@ describe Admin::UsersController do
end end
it 'deletes the user and their contributions when hard delete is specified' do 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(response).to have_gitlab_http_status(200)
expect(User.exists?(user.id)).to be_falsy expect(User.exists?(user.id)).to be_falsy
...@@ -35,7 +35,7 @@ describe Admin::UsersController do ...@@ -35,7 +35,7 @@ describe Admin::UsersController do
describe 'PUT block/:id' do describe 'PUT block/:id' do
it 'blocks user' do it 'blocks user' do
put :block, id: user.username put :block, params: { id: user.username }
user.reload user.reload
expect(user.blocked?).to be_truthy expect(user.blocked?).to be_truthy
expect(flash[:notice]).to eq 'Successfully blocked' expect(flash[:notice]).to eq 'Successfully blocked'
...@@ -51,7 +51,7 @@ describe Admin::UsersController do ...@@ -51,7 +51,7 @@ describe Admin::UsersController do
end end
it 'does not unblock user' do it 'does not unblock user' do
put :unblock, id: user.username put :unblock, params: { id: user.username }
user.reload user.reload
expect(user.blocked?).to be_truthy expect(user.blocked?).to be_truthy
expect(flash[:alert]).to eq 'This user cannot be unlocked manually from GitLab' expect(flash[:alert]).to eq 'This user cannot be unlocked manually from GitLab'
...@@ -64,7 +64,7 @@ describe Admin::UsersController do ...@@ -64,7 +64,7 @@ describe Admin::UsersController do
end end
it 'unblocks user' do it 'unblocks user' do
put :unblock, id: user.username put :unblock, params: { id: user.username }
user.reload user.reload
expect(user.blocked?).to be_falsey expect(user.blocked?).to be_falsey
expect(flash[:notice]).to eq 'Successfully unblocked' expect(flash[:notice]).to eq 'Successfully unblocked'
...@@ -79,7 +79,7 @@ describe Admin::UsersController do ...@@ -79,7 +79,7 @@ describe Admin::UsersController do
end end
it 'unlocks user' do it 'unlocks user' do
put :unlock, id: user.username put :unlock, params: { id: user.username }
user.reload user.reload
expect(user.access_locked?).to be_falsey expect(user.access_locked?).to be_falsey
end end
...@@ -93,7 +93,7 @@ describe Admin::UsersController do ...@@ -93,7 +93,7 @@ describe Admin::UsersController do
end end
it 'confirms user' do it 'confirms user' do
put :confirm, id: user.username put :confirm, params: { id: user.username }
user.reload user.reload
expect(user.confirmed?).to be_truthy expect(user.confirmed?).to be_truthy
end end
...@@ -121,17 +121,17 @@ describe Admin::UsersController do ...@@ -121,17 +121,17 @@ describe Admin::UsersController do
end end
def go def go
patch :disable_two_factor, id: user.to_param patch :disable_two_factor, params: { id: user.to_param }
end end
end end
describe 'POST create' do describe 'POST create' do
it 'creates the user' 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 end
it 'shows only one error message for an invalid email' do 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") expect(assigns[:user].errors).to contain_exactly("Email is invalid")
end end
end end
...@@ -147,7 +147,7 @@ describe Admin::UsersController do ...@@ -147,7 +147,7 @@ describe Admin::UsersController do
} }
} }
post :update, params post :update, params: params
end end
context 'when the admin changes his own password' do context 'when the admin changes his own password' do
...@@ -227,13 +227,13 @@ describe Admin::UsersController do ...@@ -227,13 +227,13 @@ describe Admin::UsersController do
end end
it "shows a notice" do 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") expect(flash[:alert]).to eq("You cannot impersonate a blocked user")
end end
it "doesn't sign us in as the user" do 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) expect(warden.user).to eq(admin)
end end
...@@ -241,25 +241,25 @@ describe Admin::UsersController do ...@@ -241,25 +241,25 @@ describe Admin::UsersController do
context "when the user is not blocked" do context "when the user is not blocked" do
it "stores the impersonator in the session" 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) expect(session[:impersonator_id]).to eq(admin.id)
end end
it "signs us in as the user" do 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) expect(warden.user).to eq(user)
end end
it "redirects to root" do it "redirects to root" do
post :impersonate, id: user.username post :impersonate, params: { id: user.username }
expect(response).to redirect_to(root_path) expect(response).to redirect_to(root_path)
end end
it "shows a notice" do 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}") expect(flash[:alert]).to eq("You are now impersonating #{user.username}")
end end
...@@ -271,7 +271,7 @@ describe Admin::UsersController do ...@@ -271,7 +271,7 @@ describe Admin::UsersController do
end end
it "shows error page" do it "shows error page" do
post :impersonate, id: user.username post :impersonate, params: { id: user.username }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
......
...@@ -522,13 +522,13 @@ describe ApplicationController do ...@@ -522,13 +522,13 @@ describe ApplicationController do
end end
it 'renders a 403 when a message is passed to access denied' do 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) expect(response).to have_gitlab_http_status(403)
end end
it 'renders a status passed to access denied' do 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) expect(response).to have_gitlab_http_status(401)
end end
...@@ -548,7 +548,7 @@ describe ApplicationController do ...@@ -548,7 +548,7 @@ describe ApplicationController do
end end
context 'html' do context 'html' do
subject { get :index, text: "hi \255" } subject { get :index, params: { text: "hi \255" } }
it 'renders 412' do it 'renders 412' do
expect { subject }.to raise_error(ActionController::BadRequest) expect { subject }.to raise_error(ActionController::BadRequest)
...@@ -556,7 +556,7 @@ describe ApplicationController do ...@@ -556,7 +556,7 @@ describe ApplicationController do
end end
context 'js' do context 'js' do
subject { get :index, text: "hi \255", format: :js } subject { get :index, format: :js, params: { text: "hi \255" } }
it 'renders 412' do it 'renders 412' do
expect { subject }.to raise_error(ActionController::BadRequest) expect { subject }.to raise_error(ActionController::BadRequest)
......
...@@ -15,7 +15,7 @@ describe AutocompleteController do ...@@ -15,7 +15,7 @@ describe AutocompleteController do
describe 'GET #users with project ID' do describe 'GET #users with project ID' do
before do before do
get(:users, project_id: project.id) get(:users, params: { project_id: project.id })
end end
it 'returns the project members' do it 'returns the project members' do
...@@ -27,7 +27,7 @@ describe AutocompleteController do ...@@ -27,7 +27,7 @@ describe AutocompleteController do
describe 'GET #users with unknown project' do describe 'GET #users with unknown project' do
before do before do
get(:users, project_id: 'unknown') get(:users, params: { project_id: 'unknown' })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(404) }
...@@ -44,7 +44,7 @@ describe AutocompleteController do ...@@ -44,7 +44,7 @@ describe AutocompleteController do
describe 'GET #users with group ID' do describe 'GET #users with group ID' do
before do before do
get(:users, group_id: group.id) get(:users, params: { group_id: group.id })
end end
it 'returns the group members' do it 'returns the group members' do
...@@ -56,7 +56,7 @@ describe AutocompleteController do ...@@ -56,7 +56,7 @@ describe AutocompleteController do
describe 'GET #users with unknown group ID' do describe 'GET #users with unknown group ID' do
before do before do
get(:users, group_id: 'unknown') get(:users, params: { group_id: 'unknown' })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(404) }
...@@ -72,7 +72,7 @@ describe AutocompleteController do ...@@ -72,7 +72,7 @@ describe AutocompleteController do
describe 'GET #users with project ID' do describe 'GET #users with project ID' do
before do before do
get(:users, project_id: project.id, current_user: true) get(:users, params: { project_id: project.id, current_user: true })
end end
it 'returns the project members and non-members' do it 'returns the project members and non-members' do
...@@ -100,7 +100,7 @@ describe AutocompleteController do ...@@ -100,7 +100,7 @@ describe AutocompleteController do
user1 = create(:user, username: 'user1', name: 'Ian') user1 = create(:user, username: 'user1', name: 'Ian')
sign_in(user) sign_in(user)
get(:users, search: 'user') get(:users, params: { search: 'user' })
response_usernames = json_response.map { |user| user['username'] } response_usernames = json_response.map { |user| user['username'] }
...@@ -128,7 +128,7 @@ describe AutocompleteController do ...@@ -128,7 +128,7 @@ describe AutocompleteController do
describe 'GET #users with public project' do describe 'GET #users with public project' do
before do before do
public_project.add_guest(user) public_project.add_guest(user)
get(:users, project_id: public_project.id) get(:users, params: { project_id: public_project.id })
end end
it { expect(json_response).to be_kind_of(Array) } it { expect(json_response).to be_kind_of(Array) }
...@@ -137,7 +137,7 @@ describe AutocompleteController do ...@@ -137,7 +137,7 @@ describe AutocompleteController do
describe 'GET #users with project' do describe 'GET #users with project' do
before do before do
get(:users, project_id: project.id) get(:users, params: { project_id: project.id })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(404) }
...@@ -145,7 +145,7 @@ describe AutocompleteController do ...@@ -145,7 +145,7 @@ describe AutocompleteController do
describe 'GET #users with unknown project' do describe 'GET #users with unknown project' do
before do before do
get(:users, project_id: 'unknown') get(:users, params: { project_id: 'unknown' })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(404) }
...@@ -154,7 +154,7 @@ describe AutocompleteController do ...@@ -154,7 +154,7 @@ describe AutocompleteController do
describe 'GET #users with inaccessible group' do describe 'GET #users with inaccessible group' do
before do before do
project.add_guest(user) project.add_guest(user)
get(:users, group_id: user.namespace.id) get(:users, params: { group_id: user.namespace.id })
end end
it { expect(response).to have_gitlab_http_status(404) } it { expect(response).to have_gitlab_http_status(404) }
...@@ -171,7 +171,7 @@ describe AutocompleteController do ...@@ -171,7 +171,7 @@ describe AutocompleteController do
describe 'GET #users with todo filter' do describe 'GET #users with todo filter' do
it 'gives an array of users' 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(response.status).to eq 200
expect(json_response).to be_kind_of(Array) expect(json_response).to be_kind_of(Array)
...@@ -186,13 +186,13 @@ describe AutocompleteController do ...@@ -186,13 +186,13 @@ describe AutocompleteController do
end end
it 'includes the author' do 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 expect(json_response.first["username"]).to eq non_member.username
end end
it 'rejects non existent user ids' do 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) expect(json_response.collect { |u| u['id'] }).not_to include(99999)
end end
...@@ -200,7 +200,7 @@ describe AutocompleteController do ...@@ -200,7 +200,7 @@ describe AutocompleteController do
context 'without authenticating' do context 'without authenticating' do
it 'returns empty result' 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 expect(json_response).to be_empty
end end
...@@ -213,7 +213,7 @@ describe AutocompleteController do ...@@ -213,7 +213,7 @@ describe AutocompleteController do
end end
it 'skips the user IDs passed' do 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'] } response_user_ids = json_response.map { |user| user['id'] }
...@@ -238,7 +238,7 @@ describe AutocompleteController do ...@@ -238,7 +238,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID' do describe 'GET #projects with project ID' do
before do before do
get(:projects, project_id: project.id) get(:projects, params: { project_id: project.id })
end end
it 'returns projects' do it 'returns projects' do
...@@ -259,7 +259,7 @@ describe AutocompleteController do ...@@ -259,7 +259,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID and search' do describe 'GET #projects with project ID and search' do
before do before do
get(:projects, project_id: project.id, search: 'rugged') get(:projects, params: { project_id: project.id, search: 'rugged' })
end end
it 'returns projects' do it 'returns projects' do
...@@ -283,7 +283,7 @@ describe AutocompleteController do ...@@ -283,7 +283,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID' do describe 'GET #projects with project ID' do
before do before do
get(:projects, project_id: project.id) get(:projects, params: { project_id: project.id })
end end
it 'returns projects' do it 'returns projects' do
...@@ -305,7 +305,7 @@ describe AutocompleteController do ...@@ -305,7 +305,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID and offset_id' do describe 'GET #projects with project ID and offset_id' do
before 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 end
it 'returns projects' do it 'returns projects' do
...@@ -324,7 +324,7 @@ describe AutocompleteController do ...@@ -324,7 +324,7 @@ describe AutocompleteController do
describe 'GET #projects with project ID' do describe 'GET #projects with project ID' do
before do before do
get(:projects, project_id: project.id) get(:projects, params: { project_id: project.id })
end end
it 'returns no projects' do it 'returns no projects' do
......
...@@ -153,7 +153,7 @@ describe Boards::IssuesController do ...@@ -153,7 +153,7 @@ describe Boards::IssuesController do
params[:project_id] = project params[:project_id] = project
end end
get :index, params.compact get :index, params: params.compact
end end
end end
...@@ -230,9 +230,11 @@ describe Boards::IssuesController do ...@@ -230,9 +230,11 @@ describe Boards::IssuesController do
def create_issue(user:, board:, list:, title:) def create_issue(user:, board:, list:, title:)
sign_in(user) sign_in(user)
post :create, board_id: board.to_param, post :create, params: {
list_id: list.to_param, board_id: board.to_param,
issue: { title: title, project_id: project.id }, list_id: list.to_param,
issue: { title: title, project_id: project.id }
},
format: :json format: :json
end end
end end
...@@ -291,12 +293,14 @@ describe Boards::IssuesController do ...@@ -291,12 +293,14 @@ describe Boards::IssuesController do
def move(user:, board:, issue:, from_list_id:, to_list_id:) def move(user:, board:, issue:, from_list_id:, to_list_id:)
sign_in(user) sign_in(user)
patch :update, namespace_id: project.namespace.to_param, patch :update, params: {
project_id: project.id, namespace_id: project.namespace.to_param,
board_id: board.to_param, project_id: project.id,
id: issue.id, board_id: board.to_param,
from_list_id: from_list_id, id: issue.id,
to_list_id: to_list_id, from_list_id: from_list_id,
to_list_id: to_list_id
},
format: :json format: :json
end end
end end
......
...@@ -46,9 +46,11 @@ describe Boards::ListsController do ...@@ -46,9 +46,11 @@ describe Boards::ListsController do
def read_board_list(user:, board:) def read_board_list(user:, board:)
sign_in(user) sign_in(user)
get :index, namespace_id: project.namespace.to_param, get :index, params: {
project_id: project, namespace_id: project.namespace.to_param,
board_id: board.to_param, project_id: project,
board_id: board.to_param
},
format: :json format: :json
end end
end end
...@@ -103,10 +105,12 @@ describe Boards::ListsController do ...@@ -103,10 +105,12 @@ describe Boards::ListsController do
def create_board_list(user:, board:, label_id:) def create_board_list(user:, board:, label_id:)
sign_in(user) sign_in(user)
post :create, namespace_id: project.namespace.to_param, post :create, params: {
project_id: project, namespace_id: project.namespace.to_param,
board_id: board.to_param, project_id: project,
list: { label_id: label_id }, board_id: board.to_param,
list: { label_id: label_id }
},
format: :json format: :json
end end
end end
...@@ -201,10 +205,12 @@ describe Boards::ListsController do ...@@ -201,10 +205,12 @@ describe Boards::ListsController do
def remove_board_list(user:, board:, list:) def remove_board_list(user:, board:, list:)
sign_in(user) sign_in(user)
delete :destroy, namespace_id: project.namespace.to_param, delete :destroy, params: {
project_id: project, namespace_id: project.namespace.to_param,
board_id: board.to_param, project_id: project,
id: list.to_param, board_id: board.to_param,
id: list.to_param
},
format: :json format: :json
end end
end end
...@@ -245,9 +251,11 @@ describe Boards::ListsController do ...@@ -245,9 +251,11 @@ describe Boards::ListsController do
def generate_default_lists(user:, board:) def generate_default_lists(user:, board:)
sign_in(user) sign_in(user)
post :generate, namespace_id: project.namespace.to_param, post :generate, params: {
project_id: project, namespace_id: project.namespace.to_param,
board_id: board.to_param, project_id: project,
board_id: board.to_param
},
format: :json format: :json
end end
end end
......
...@@ -70,7 +70,7 @@ describe ControllerWithCrossProjectAccessCheck do ...@@ -70,7 +70,7 @@ describe ControllerWithCrossProjectAccessCheck do
end end
it 'correctly renders an action that does not require cross project access' do 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -131,13 +131,13 @@ describe ControllerWithCrossProjectAccessCheck do ...@@ -131,13 +131,13 @@ describe ControllerWithCrossProjectAccessCheck do
end end
it 'does not skip the check on an action that is not skipped' do 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) expect(response).to have_gitlab_http_status(403)
end end
it 'does not skip the check on an action that was not defined to skip' do 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) expect(response).to have_gitlab_http_status(403)
end end
......
...@@ -23,7 +23,7 @@ describe GroupTree do ...@@ -23,7 +23,7 @@ describe GroupTree do
other_group = create(:group, name: 'filter') other_group = create(:group, name: 'filter')
other_group.add_owner(user) 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) expect(assigns(:groups)).to contain_exactly(other_group)
end end
...@@ -40,7 +40,7 @@ describe GroupTree do ...@@ -40,7 +40,7 @@ describe GroupTree do
it 'contains only the subgroup when a parent was given' do it 'contains only the subgroup when a parent was given' do
subgroup = create(:group, :public, parent: group) 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) expect(assigns(:groups)).to contain_exactly(subgroup)
end end
...@@ -48,7 +48,7 @@ describe GroupTree do ...@@ -48,7 +48,7 @@ describe GroupTree do
it 'allows filtering for subgroups and includes the parents for rendering' do it 'allows filtering for subgroups and includes the parents for rendering' do
subgroup = create(:group, :public, parent: group, name: 'filter') 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) expect(assigns(:groups)).to contain_exactly(group, subgroup)
end end
...@@ -59,7 +59,7 @@ describe GroupTree do ...@@ -59,7 +59,7 @@ describe GroupTree do
subgroup.add_developer(user) subgroup.add_developer(user)
_other_subgroup = create(:group, :private, parent: parent, name: 'filte') _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) expect(assigns(:groups)).to contain_exactly(parent, subgroup)
end end
...@@ -70,7 +70,7 @@ describe GroupTree do ...@@ -70,7 +70,7 @@ describe GroupTree do
subgroup = create(:group, :public, parent: group) subgroup = create(:group, :public, parent: group)
search_result = create(:group, :public, name: 'result', parent: subgroup) 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) expect(assigns(:groups)).to contain_exactly(group, subgroup, search_result)
end end
...@@ -87,7 +87,7 @@ describe GroupTree do ...@@ -87,7 +87,7 @@ describe GroupTree do
it 'expands the tree when filtering' do it 'expands the tree when filtering' do
subgroup = create(:group, :public, parent: group, name: 'filter') 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'] children_response = json_response.first['children']
......
...@@ -34,7 +34,7 @@ describe LfsRequest do ...@@ -34,7 +34,7 @@ describe LfsRequest do
describe '#storage_project' do describe '#storage_project' do
it 'assigns the project as 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) expect(assigns(:storage_project)).to eq(project)
end end
...@@ -42,7 +42,7 @@ describe LfsRequest do ...@@ -42,7 +42,7 @@ describe LfsRequest do
it 'assigns the source of a forked project' do it 'assigns the source of a forked project' do
forked_project = fork_project(project) 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) expect(assigns(:storage_project)).to eq(project)
end end
......
...@@ -33,7 +33,7 @@ describe Dashboard::GroupsController do ...@@ -33,7 +33,7 @@ describe Dashboard::GroupsController do
end end
it 'renders only groups the user is a member of when searching hierarchy correctly' do 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) expect(response).to have_gitlab_http_status(200)
all_groups = [top_level_result, top_level_a, sub_level_result_a] all_groups = [top_level_result, top_level_a, sub_level_result_a]
......
...@@ -34,7 +34,7 @@ describe Dashboard::MilestonesController do ...@@ -34,7 +34,7 @@ describe Dashboard::MilestonesController do
render_views render_views
def view_milestone def view_milestone
get :show, id: milestone.safe_title, title: milestone.title get :show, params: { id: milestone.safe_title, title: milestone.title }
end end
it 'shows milestone page' do it 'shows milestone page' do
......
...@@ -16,19 +16,19 @@ describe Dashboard::TodosController do ...@@ -16,19 +16,19 @@ describe Dashboard::TodosController do
it 'renders 404 when user does not have read access on given project' do it 'renders 404 when user does not have read access on given project' do
unauthorized_project = create(:project, :private) 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) expect(response).to have_gitlab_http_status(404)
end end
it 'renders 404 when given project does not exists' do 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) expect(response).to have_gitlab_http_status(404)
end end
it 'renders 200 when filtering for "any project" todos' do 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -36,7 +36,7 @@ describe Dashboard::TodosController do ...@@ -36,7 +36,7 @@ describe Dashboard::TodosController do
it 'renders 200 when user has access on given project' do it 'renders 200 when user has access on given project' do
authorized_project = create(:project, :public) 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -46,7 +46,7 @@ describe Dashboard::TodosController do ...@@ -46,7 +46,7 @@ describe Dashboard::TodosController do
it 'renders 404 when user does not have read access on given group' do it 'renders 404 when user does not have read access on given group' do
unauthorized_group = create(:group, :private) 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -62,13 +62,13 @@ describe Dashboard::TodosController do ...@@ -62,13 +62,13 @@ describe Dashboard::TodosController do
end end
it 'redirects to last_page if page number is larger than number of pages' do 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)) expect(response).to redirect_to(dashboard_todos_path(page: last_page))
end end
it 'goes to the correct page' do 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(assigns(:todos).current_page).to eq(last_page)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
...@@ -76,7 +76,7 @@ describe Dashboard::TodosController do ...@@ -76,7 +76,7 @@ describe Dashboard::TodosController do
it 'does not redirect to external sites when provided a host field' do it 'does not redirect to external sites when provided a host field' do
external_host = "www.example.com" 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)) expect(response).to redirect_to(dashboard_todos_path(page: last_page))
end end
...@@ -87,7 +87,7 @@ describe Dashboard::TodosController do ...@@ -87,7 +87,7 @@ describe Dashboard::TodosController do
expect(user).to receive(:todos_pending_count).and_call_original 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)) expect(response).to redirect_to(dashboard_todos_path(page: last_page, sort: :created_asc))
end end
...@@ -99,7 +99,7 @@ describe Dashboard::TodosController do ...@@ -99,7 +99,7 @@ describe Dashboard::TodosController do
expect(user).not_to receive(:todos_pending_count) 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)) expect(response).to redirect_to(dashboard_todos_path(page: last_page, project_id: project.id))
end end
...@@ -111,7 +111,7 @@ describe Dashboard::TodosController do ...@@ -111,7 +111,7 @@ describe Dashboard::TodosController do
let(:todo) { create(:todo, :done, user: user, project: project, author: author) } let(:todo) { create(:todo, :done, user: user, project: project, author: author) }
it 'restores the todo to pending state' do 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(todo.reload).to be_pending
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
...@@ -123,7 +123,7 @@ describe Dashboard::TodosController do ...@@ -123,7 +123,7 @@ describe Dashboard::TodosController do
let(:todos) { create_list(:todo, 2, :done, user: user, project: project, author: author) } let(:todos) { create_list(:todo, 2, :done, user: user, project: project, author: author) }
it 'restores the todos to pending state' do 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| todos.each do |todo|
expect(todo.reload).to be_pending expect(todo.reload).to be_pending
......
...@@ -12,13 +12,13 @@ describe Explore::ProjectsController do ...@@ -12,13 +12,13 @@ describe Explore::ProjectsController do
end end
it 'sorts by last updated' do it 'sorts by last updated' do
get :trending, sort: 'updated_desc' get :trending, params: { sort: 'updated_desc' }
expect(assigns(:projects)).to eq [project2, project1] expect(assigns(:projects)).to eq [project2, project1]
end end
it 'sorts by oldest updated' do it 'sorts by oldest updated' do
get :trending, sort: 'updated_asc' get :trending, params: { sort: 'updated_asc' }
expect(assigns(:projects)).to eq [project1, project2] expect(assigns(:projects)).to eq [project1, project2]
end end
......
...@@ -6,7 +6,7 @@ describe GoogleApi::AuthorizationsController do ...@@ -6,7 +6,7 @@ describe GoogleApi::AuthorizationsController do
let(:token) { 'token' } let(:token) { 'token' }
let(:expires_at) { 1.hour.since.strftime('%s') } 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 before do
sign_in(user) sign_in(user)
......
...@@ -103,7 +103,7 @@ describe GraphqlController do ...@@ -103,7 +103,7 @@ describe GraphqlController do
} }
QUERY 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 end
def query_response def query_response
......
...@@ -10,7 +10,7 @@ describe Groups::AvatarsController do ...@@ -10,7 +10,7 @@ describe Groups::AvatarsController do
end end
it 'removes avatar from DB calling destroy' do it 'removes avatar from DB calling destroy' do
delete :destroy, group_id: group.path delete :destroy, params: { group_id: group.path }
@group = assigns(:group) @group = assigns(:group)
expect(@group.avatar.present?).to be_falsey expect(@group.avatar.present?).to be_falsey
expect(@group).to be_valid expect(@group).to be_valid
......
...@@ -105,7 +105,7 @@ describe Groups::BoardsController do ...@@ -105,7 +105,7 @@ describe Groups::BoardsController do
end end
def list_boards(format: :html) def list_boards(format: :html)
get :index, group_id: group, format: format get :index, params: { group_id: group }, format: format
end end
end end
...@@ -183,8 +183,10 @@ describe Groups::BoardsController do ...@@ -183,8 +183,10 @@ describe Groups::BoardsController do
end end
def read_board(board:, format: :html) def read_board(board:, format: :html)
get :show, group_id: group, get :show, params: {
id: board.to_param, group_id: group,
id: board.to_param
},
format: format format: format
end end
end end
......
...@@ -16,7 +16,7 @@ describe Groups::ChildrenController do ...@@ -16,7 +16,7 @@ describe Groups::ChildrenController do
end end
it 'shows all children' do 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) expect(assigns(:children)).to contain_exactly(public_project, private_project)
end end
...@@ -26,7 +26,7 @@ describe Groups::ChildrenController do ...@@ -26,7 +26,7 @@ describe Groups::ChildrenController do
group_member.destroy! group_member.destroy!
private_project.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_project, private_project) expect(assigns(:children)).to contain_exactly(public_project, private_project)
end end
...@@ -35,7 +35,7 @@ describe Groups::ChildrenController do ...@@ -35,7 +35,7 @@ describe Groups::ChildrenController do
context 'as a guest' do context 'as a guest' do
it 'shows the public children' 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) expect(assigns(:children)).to contain_exactly(public_project)
end end
...@@ -54,7 +54,7 @@ describe Groups::ChildrenController do ...@@ -54,7 +54,7 @@ describe Groups::ChildrenController do
end end
it 'shows all children' do 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) expect(assigns(:children)).to contain_exactly(public_subgroup, private_subgroup, public_project, private_project)
end end
...@@ -65,7 +65,7 @@ describe Groups::ChildrenController do ...@@ -65,7 +65,7 @@ describe Groups::ChildrenController do
private_subgroup.add_guest(user) private_subgroup.add_guest(user)
private_project.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) expect(assigns(:children)).to contain_exactly(public_subgroup, private_subgroup, public_project, private_project)
end end
...@@ -74,7 +74,7 @@ describe Groups::ChildrenController do ...@@ -74,7 +74,7 @@ describe Groups::ChildrenController do
context 'as a guest' do context 'as a guest' do
it 'shows the public children' 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) expect(assigns(:children)).to contain_exactly(public_subgroup, public_project)
end end
...@@ -84,7 +84,7 @@ describe Groups::ChildrenController do ...@@ -84,7 +84,7 @@ describe Groups::ChildrenController do
it 'expands the tree for matching projects' do it 'expands the tree for matching projects' do
project = create(:project, :public, namespace: public_subgroup, name: 'filterme') 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 group_json = json_response.first
project_json = group_json['children'].first project_json = group_json['children'].first
...@@ -96,7 +96,7 @@ describe Groups::ChildrenController do ...@@ -96,7 +96,7 @@ describe Groups::ChildrenController do
it 'expands the tree for matching subgroups' do it 'expands the tree for matching subgroups' do
matched_group = create(:group, :public, parent: public_subgroup, name: 'filterme') 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 group_json = json_response.first
matched_group_json = group_json['children'].first matched_group_json = group_json['children'].first
...@@ -113,7 +113,7 @@ describe Groups::ChildrenController do ...@@ -113,7 +113,7 @@ describe Groups::ChildrenController do
l3_subgroup = create(:group, :public, parent: l2_subgroup, path: 'wifi-group') l3_subgroup = create(:group, :public, parent: l2_subgroup, path: 'wifi-group')
matched_project_2 = create(:project, :public, namespace: l3_subgroup, name: 'mobile') 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 shared_group_json = json_response.first
expect(shared_group_json['id']).to eq(shared_subgroup.id) expect(shared_group_json['id']).to eq(shared_subgroup.id)
...@@ -136,7 +136,7 @@ describe Groups::ChildrenController do ...@@ -136,7 +136,7 @@ describe Groups::ChildrenController do
l2_subgroup = create(:group, :public, parent: subgroup) l2_subgroup = create(:group, :public, parent: subgroup)
create(:project, :public, namespace: l2_subgroup, name: 'test') 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) expect(response).to have_http_status(200)
end end
...@@ -144,7 +144,7 @@ describe Groups::ChildrenController do ...@@ -144,7 +144,7 @@ describe Groups::ChildrenController do
it 'returns an array with one element when only one result is matched' do it 'returns an array with one element when only one result is matched' do
create(:project, :public, namespace: group, name: 'match') 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).to be_kind_of(Array)
expect(json_response.size).to eq(1) expect(json_response.size).to eq(1)
...@@ -155,7 +155,7 @@ describe Groups::ChildrenController do ...@@ -155,7 +155,7 @@ describe Groups::ChildrenController do
l2_subgroup = create(:group, :public, parent: subgroup) l2_subgroup = create(:group, :public, parent: subgroup)
create(:project, :public, namespace: l2_subgroup, name: 'no-match') 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([]) expect(json_response).to eq([])
end end
...@@ -179,7 +179,7 @@ describe Groups::ChildrenController do ...@@ -179,7 +179,7 @@ describe Groups::ChildrenController do
end end
group_to_nest.update!(parent: subgroup) 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -187,7 +187,7 @@ describe Groups::ChildrenController do ...@@ -187,7 +187,7 @@ describe Groups::ChildrenController do
it 'includes pagination headers' do it 'includes pagination headers' do
2.times { |i| create(:group, :public, parent: public_subgroup, name: "filterme#{i}") } 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 expect(response).to include_pagination_headers
end end
...@@ -203,7 +203,7 @@ describe Groups::ChildrenController do ...@@ -203,7 +203,7 @@ describe Groups::ChildrenController do
let(:expected_queries_per_project) { 0 } let(:expected_queries_per_project) { 0 }
def get_list def get_list
get :index, group_id: group.to_param, format: :json get :index, params: { group_id: group.to_param }, format: :json
end end
it 'queries the expected amount for a group row' do it 'queries the expected amount for a group row' do
...@@ -227,7 +227,7 @@ describe Groups::ChildrenController do ...@@ -227,7 +227,7 @@ describe Groups::ChildrenController do
let(:extra_queries_for_hierarchies) { 1 } let(:extra_queries_for_hierarchies) { 1 }
def get_filtered_list 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 end
it 'queries the expected amount when nested rows are increased for a group' do it 'queries the expected amount when nested rows are increased for a group' do
...@@ -276,13 +276,13 @@ describe Groups::ChildrenController do ...@@ -276,13 +276,13 @@ describe Groups::ChildrenController do
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group ) } let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group ) }
it 'has projects on the first page' do 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) expect(assigns(:children)).to contain_exactly(*first_page_projects)
end end
it 'has projects on the second page' do 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) expect(assigns(:children)).to contain_exactly(other_project)
end end
...@@ -294,13 +294,13 @@ describe Groups::ChildrenController do ...@@ -294,13 +294,13 @@ describe Groups::ChildrenController do
let!(:next_page_projects) { create_list(:project, per_page, :public, namespace: group) } let!(:next_page_projects) { create_list(:project, per_page, :public, namespace: group) }
it 'contains all subgroups' do 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) expect(assigns(:children)).to contain_exactly(*first_page_subgroups)
end end
it 'contains the project and group on the second page' do 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)) expect(assigns(:children)).to contain_exactly(other_subgroup, *next_page_projects.take(per_page - 1))
end end
...@@ -310,7 +310,7 @@ describe Groups::ChildrenController do ...@@ -310,7 +310,7 @@ describe Groups::ChildrenController do
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group) } let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group) }
it 'correctly calculates the counts' do 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) expect(response).to have_gitlab_http_status(200)
end end
......
...@@ -81,7 +81,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -81,7 +81,7 @@ describe Groups::Clusters::ApplicationsController do
end end
def go def go
post :create, params.merge(group_id: group) post :create, params: params.merge(group_id: group)
end end
end end
end end
...@@ -17,7 +17,7 @@ describe Groups::ClustersController do ...@@ -17,7 +17,7 @@ describe Groups::ClustersController do
describe 'GET index' do describe 'GET index' do
def go(params = {}) def go(params = {})
get :index, params.reverse_merge(group_id: group) get :index, params: params.reverse_merge(group_id: group)
end end
context 'when feature flag is not enabled' do context 'when feature flag is not enabled' do
...@@ -104,7 +104,7 @@ describe Groups::ClustersController do ...@@ -104,7 +104,7 @@ describe Groups::ClustersController do
describe 'GET new' do describe 'GET new' do
def go def go
get :new, group_id: group get :new, params: { group_id: group }
end end
describe 'functionality for new cluster' do describe 'functionality for new cluster' do
...@@ -198,7 +198,7 @@ describe Groups::ClustersController do ...@@ -198,7 +198,7 @@ describe Groups::ClustersController do
end end
def go def go
post :create_gcp, params.merge(group_id: group) post :create_gcp, params: params.merge(group_id: group)
end end
describe 'functionality' do describe 'functionality' do
...@@ -287,7 +287,7 @@ describe Groups::ClustersController do ...@@ -287,7 +287,7 @@ describe Groups::ClustersController do
end end
def go def go
post :create_user, params.merge(group_id: group) post :create_user, params: params.merge(group_id: group)
end end
describe 'functionality' do describe 'functionality' do
...@@ -353,8 +353,10 @@ describe Groups::ClustersController do ...@@ -353,8 +353,10 @@ describe Groups::ClustersController do
def go def go
get :cluster_status, get :cluster_status,
group_id: group.to_param, params: {
id: cluster, group_id: group.to_param,
id: cluster
},
format: :json format: :json
end end
...@@ -390,8 +392,10 @@ describe Groups::ClustersController do ...@@ -390,8 +392,10 @@ describe Groups::ClustersController do
def go def go
get :show, get :show,
group_id: group, params: {
id: cluster group_id: group,
id: cluster
}
end end
describe 'functionality' do describe 'functionality' do
...@@ -417,7 +421,7 @@ describe Groups::ClustersController do ...@@ -417,7 +421,7 @@ describe Groups::ClustersController do
describe 'PUT update' do describe 'PUT update' do
def go(format: :html) def go(format: :html)
put :update, params.merge( put :update, params: params.merge(
group_id: group.to_param, group_id: group.to_param,
id: cluster, id: cluster,
format: format format: format
...@@ -505,8 +509,10 @@ describe Groups::ClustersController do ...@@ -505,8 +509,10 @@ describe Groups::ClustersController do
def go def go
delete :destroy, delete :destroy,
group_id: group, params: {
id: cluster group_id: group,
id: cluster
}
end end
describe 'functionality' do describe 'functionality' do
......
...@@ -6,7 +6,7 @@ describe Groups::GroupMembersController do ...@@ -6,7 +6,7 @@ describe Groups::GroupMembersController do
describe 'GET index' do describe 'GET index' do
it 'renders index with 200 status code' 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 have_gitlab_http_status(200)
expect(response).to render_template(:index) expect(response).to render_template(:index)
...@@ -26,9 +26,11 @@ describe Groups::GroupMembersController do ...@@ -26,9 +26,11 @@ describe Groups::GroupMembersController do
end end
it 'returns 403' do it 'returns 403' do
post :create, group_id: group, post :create, params: {
user_ids: group_user.id, group_id: group,
access_level: Gitlab::Access::GUEST user_ids: group_user.id,
access_level: Gitlab::Access::GUEST
}
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(403)
expect(group.users).not_to include group_user expect(group.users).not_to include group_user
...@@ -41,9 +43,11 @@ describe Groups::GroupMembersController do ...@@ -41,9 +43,11 @@ describe Groups::GroupMembersController do
end end
it 'adds user to members' do it 'adds user to members' do
post :create, group_id: group, post :create, params: {
user_ids: group_user.id, group_id: group,
access_level: Gitlab::Access::GUEST user_ids: group_user.id,
access_level: Gitlab::Access::GUEST
}
expect(response).to set_flash.to 'Users were successfully added.' expect(response).to set_flash.to 'Users were successfully added.'
expect(response).to redirect_to(group_group_members_path(group)) expect(response).to redirect_to(group_group_members_path(group))
...@@ -51,9 +55,11 @@ describe Groups::GroupMembersController do ...@@ -51,9 +55,11 @@ describe Groups::GroupMembersController do
end end
it 'adds no user to members' do it 'adds no user to members' do
post :create, group_id: group, post :create, params: {
user_ids: '', group_id: group,
access_level: Gitlab::Access::GUEST user_ids: '',
access_level: Gitlab::Access::GUEST
}
expect(response).to set_flash.to 'No users specified.' expect(response).to set_flash.to 'No users specified.'
expect(response).to redirect_to(group_group_members_path(group)) expect(response).to redirect_to(group_group_members_path(group))
...@@ -90,7 +96,7 @@ describe Groups::GroupMembersController do ...@@ -90,7 +96,7 @@ describe Groups::GroupMembersController do
context 'when member is not found' do context 'when member is not found' do
it 'returns 403' 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) expect(response).to have_gitlab_http_status(403)
end end
...@@ -103,7 +109,7 @@ describe Groups::GroupMembersController do ...@@ -103,7 +109,7 @@ describe Groups::GroupMembersController do
end end
it 'returns 403' do 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(response).to have_gitlab_http_status(403)
expect(group.members).to include member expect(group.members).to include member
...@@ -116,7 +122,7 @@ describe Groups::GroupMembersController do ...@@ -116,7 +122,7 @@ describe Groups::GroupMembersController do
end end
it '[HTML] removes user from members' do 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 set_flash.to 'User was successfully removed from group.'
expect(response).to redirect_to(group_group_members_path(group)) expect(response).to redirect_to(group_group_members_path(group))
...@@ -140,7 +146,7 @@ describe Groups::GroupMembersController do ...@@ -140,7 +146,7 @@ describe Groups::GroupMembersController do
context 'when member is not found' do context 'when member is not found' do
it 'returns 404' do it 'returns 404' do
delete :leave, group_id: group delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -153,7 +159,7 @@ describe Groups::GroupMembersController do ...@@ -153,7 +159,7 @@ describe Groups::GroupMembersController do
end end
it 'removes user from members' do 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 set_flash.to "You left the \"#{group.name}\" group."
expect(response).to redirect_to(dashboard_groups_path) expect(response).to redirect_to(dashboard_groups_path)
...@@ -161,7 +167,7 @@ describe Groups::GroupMembersController do ...@@ -161,7 +167,7 @@ describe Groups::GroupMembersController do
end end
it 'supports json request' do 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(response).to have_gitlab_http_status(200)
expect(json_response['notice']).to eq "You left the \"#{group.name}\" group." expect(json_response['notice']).to eq "You left the \"#{group.name}\" group."
...@@ -174,7 +180,7 @@ describe Groups::GroupMembersController do ...@@ -174,7 +180,7 @@ describe Groups::GroupMembersController do
end end
it 'cannot removes himself from the group' do 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) expect(response).to have_gitlab_http_status(403)
end end
...@@ -186,7 +192,7 @@ describe Groups::GroupMembersController do ...@@ -186,7 +192,7 @@ describe Groups::GroupMembersController do
end end
it 'removes user from members' do 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 set_flash.to 'Your access request to the group has been withdrawn.'
expect(response).to redirect_to(group_path(group)) expect(response).to redirect_to(group_path(group))
...@@ -203,7 +209,7 @@ describe Groups::GroupMembersController do ...@@ -203,7 +209,7 @@ describe Groups::GroupMembersController do
end end
it 'creates a new GroupMember that is not a team member' do 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 set_flash.to 'Your request for access has been queued for review.'
expect(response).to redirect_to(group_path(group)) expect(response).to redirect_to(group_path(group))
...@@ -221,7 +227,7 @@ describe Groups::GroupMembersController do ...@@ -221,7 +227,7 @@ describe Groups::GroupMembersController do
context 'when member is not found' do context 'when member is not found' do
it 'returns 403' 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) expect(response).to have_gitlab_http_status(403)
end end
...@@ -234,7 +240,7 @@ describe Groups::GroupMembersController do ...@@ -234,7 +240,7 @@ describe Groups::GroupMembersController do
end end
it 'returns 403' do 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(response).to have_gitlab_http_status(403)
expect(group.members).not_to include member expect(group.members).not_to include member
...@@ -247,7 +253,7 @@ describe Groups::GroupMembersController do ...@@ -247,7 +253,7 @@ describe Groups::GroupMembersController do
end end
it 'adds user to members' do 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(response).to redirect_to(group_group_members_path(group))
expect(group.members).to include member expect(group.members).to include member
......
...@@ -16,7 +16,7 @@ describe Groups::LabelsController do ...@@ -16,7 +16,7 @@ describe Groups::LabelsController do
set(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') } set(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') }
it 'returns group and project labels by default' do 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']} label_ids = json_response.map {|label| label['title']}
expect(label_ids).to match_array([label_1.title, group_label_1.title]) expect(label_ids).to match_array([label_1.title, group_label_1.title])
...@@ -31,7 +31,7 @@ describe Groups::LabelsController do ...@@ -31,7 +31,7 @@ describe Groups::LabelsController do
end end
it 'returns ancestor group labels', :nested_groups do 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']} label_ids = json_response.map {|label| label['title']}
expect(label_ids).to match_array([group_label_1.title, subgroup_label_1.title]) expect(label_ids).to match_array([group_label_1.title, subgroup_label_1.title])
...@@ -43,7 +43,7 @@ describe Groups::LabelsController do ...@@ -43,7 +43,7 @@ describe Groups::LabelsController do
it 'allows user to toggle subscription on group labels' do it 'allows user to toggle subscription on group labels' do
label = create(:group_label, group: group) 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) expect(response).to have_gitlab_http_status(200)
end end
......
...@@ -33,7 +33,7 @@ describe Groups::MilestonesController do ...@@ -33,7 +33,7 @@ describe Groups::MilestonesController do
describe '#index' do describe '#index' do
it 'shows group milestones page' 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -44,7 +44,7 @@ describe Groups::MilestonesController do ...@@ -44,7 +44,7 @@ describe Groups::MilestonesController do
let!(:legacy_milestone2) { create(:milestone, project: project2, title: 'legacy') } let!(:legacy_milestone2) { create(:milestone, project: project2, title: 'legacy') }
it 'lists legacy group milestones and group milestones' do 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) milestones = JSON.parse(response.body)
...@@ -67,7 +67,7 @@ describe Groups::MilestonesController do ...@@ -67,7 +67,7 @@ describe Groups::MilestonesController do
expect(GlobalMilestone).to receive(:build) expect(GlobalMilestone).to receive(:build)
expect(Milestone).not_to receive(:find_by_iid) 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
end end
...@@ -76,7 +76,7 @@ describe Groups::MilestonesController do ...@@ -76,7 +76,7 @@ describe Groups::MilestonesController do
expect(GlobalMilestone).not_to receive(:build) expect(GlobalMilestone).not_to receive(:build)
expect(Milestone).to receive(:find_by_iid) 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 end
end end
...@@ -86,8 +86,10 @@ describe Groups::MilestonesController do ...@@ -86,8 +86,10 @@ describe Groups::MilestonesController do
describe "#create" do describe "#create" do
it "creates group milestone with Chinese title" do it "creates group milestone with Chinese title" do
post :create, post :create,
group_id: group.to_param, params: {
milestone: milestone_params group_id: group.to_param,
milestone: milestone_params
}
milestone = Milestone.find_by_title(title) milestone = Milestone.find_by_title(title)
...@@ -105,9 +107,11 @@ describe Groups::MilestonesController do ...@@ -105,9 +107,11 @@ describe Groups::MilestonesController do
milestone_params[:title] = "title changed" milestone_params[:title] = "title changed"
put :update, put :update,
id: milestone.iid, params: {
group_id: group.to_param, id: milestone.iid,
milestone: milestone_params group_id: group.to_param,
milestone: milestone_params
}
milestone.reload milestone.reload
expect(response).to redirect_to(group_milestone_path(group, milestone.iid)) expect(response).to redirect_to(group_milestone_path(group, milestone.iid))
...@@ -124,10 +128,12 @@ describe Groups::MilestonesController do ...@@ -124,10 +128,12 @@ describe Groups::MilestonesController do
milestone_params[:state_event] = "close" milestone_params[:state_event] = "close"
put :update, put :update,
id: milestone1.title.to_slug.to_s, params: {
group_id: group.to_param, id: milestone1.title.to_slug.to_s,
milestone: milestone_params, group_id: group.to_param,
title: milestone1.title milestone: milestone_params,
title: milestone1.title
}
expect(response).to redirect_to(group_milestone_path(group, milestone1.safe_title, 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 ...@@ -145,7 +151,7 @@ describe Groups::MilestonesController do
let(:milestone) { create(:milestone, group: group) } let(:milestone) { create(:milestone, group: group) }
it "removes milestone" do 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(response).to be_success
expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound) expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound)
...@@ -162,7 +168,7 @@ describe Groups::MilestonesController do ...@@ -162,7 +168,7 @@ describe Groups::MilestonesController do
context 'non-show path' do context 'non-show path' do
context 'with exactly matching casing' do context 'with exactly matching casing' do
it 'does not redirect' 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) expect(response).not_to have_gitlab_http_status(301)
end end
...@@ -170,7 +176,7 @@ describe Groups::MilestonesController do ...@@ -170,7 +176,7 @@ describe Groups::MilestonesController do
context 'with different casing' do context 'with different casing' do
it 'redirects to the correct 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(response).to redirect_to(group_milestones_path(group.to_param))
expect(controller).not_to set_flash[:notice] expect(controller).not_to set_flash[:notice]
...@@ -181,7 +187,7 @@ describe Groups::MilestonesController do ...@@ -181,7 +187,7 @@ describe Groups::MilestonesController do
context 'show path' do context 'show path' do
context 'with exactly matching casing' do context 'with exactly matching casing' do
it 'does not redirect' 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) expect(response).not_to have_gitlab_http_status(301)
end end
...@@ -189,7 +195,7 @@ describe Groups::MilestonesController do ...@@ -189,7 +195,7 @@ describe Groups::MilestonesController do
context 'with different casing' do context 'with different casing' do
it 'redirects to the correct 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(response).to redirect_to(group_milestone_path(group.to_param, title))
expect(controller).not_to set_flash[:notice] expect(controller).not_to set_flash[:notice]
...@@ -202,7 +208,7 @@ describe Groups::MilestonesController do ...@@ -202,7 +208,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') } let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
it 'redirects to the canonical path' do 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(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)) expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
...@@ -212,7 +218,7 @@ describe Groups::MilestonesController do ...@@ -212,7 +218,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'http') } let(:redirect_route) { group.redirect_routes.create(path: 'http') }
it 'does not modify the requested host' do 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(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)) expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
...@@ -224,7 +230,7 @@ describe Groups::MilestonesController do ...@@ -224,7 +230,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'oups') } let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
it 'does not modify the /groups part of the path' do 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(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)) expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
...@@ -236,7 +242,7 @@ describe Groups::MilestonesController do ...@@ -236,7 +242,7 @@ describe Groups::MilestonesController do
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') } let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
it 'does not modify the /groups part of the path' do 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(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)) expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
...@@ -250,16 +256,20 @@ describe Groups::MilestonesController do ...@@ -250,16 +256,20 @@ describe Groups::MilestonesController do
context 'when requesting the canonical path with different casing' do context 'when requesting the canonical path with different casing' do
it 'does not 404' do it 'does not 404' do
post :create, post :create,
group_id: group.to_param, params: {
milestone: { title: title } group_id: group.to_param,
milestone: { title: title }
}
expect(response).not_to have_gitlab_http_status(404) expect(response).not_to have_gitlab_http_status(404)
end end
it 'does not redirect to the correct casing' do it 'does not redirect to the correct casing' do
post :create, post :create,
group_id: group.to_param, params: {
milestone: { title: title } group_id: group.to_param,
milestone: { title: title }
}
expect(response).not_to have_gitlab_http_status(301) expect(response).not_to have_gitlab_http_status(301)
end end
...@@ -270,8 +280,10 @@ describe Groups::MilestonesController do ...@@ -270,8 +280,10 @@ describe Groups::MilestonesController do
it 'returns not found' do it 'returns not found' do
post :create, post :create,
group_id: redirect_route.path, params: {
milestone: { title: title } group_id: redirect_route.path,
milestone: { title: title }
}
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
......
...@@ -22,7 +22,7 @@ describe Groups::RunnersController do ...@@ -22,7 +22,7 @@ describe Groups::RunnersController do
new_desc = runner.description.swapcase new_desc = runner.description.swapcase
expect do 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 } end.to change { runner.ensure_runner_queue_value }
runner.reload runner.reload
...@@ -34,7 +34,7 @@ describe Groups::RunnersController do ...@@ -34,7 +34,7 @@ describe Groups::RunnersController do
describe '#destroy' do describe '#destroy' do
it 'destroys the runner' do it 'destroys the runner' do
delete :destroy, params delete :destroy, params: params
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil expect(Ci::Runner.find_by(id: runner.id)).to be_nil
...@@ -46,7 +46,7 @@ describe Groups::RunnersController do ...@@ -46,7 +46,7 @@ describe Groups::RunnersController do
runner.update(active: false) runner.update(active: false)
expect do expect do
post :resume, params post :resume, params: params
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
runner.reload runner.reload
...@@ -61,7 +61,7 @@ describe Groups::RunnersController do ...@@ -61,7 +61,7 @@ describe Groups::RunnersController do
runner.update(active: true) runner.update(active: true)
expect do expect do
post :pause, params post :pause, params: params
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
runner.reload runner.reload
......
...@@ -11,7 +11,7 @@ describe Groups::Settings::CiCdController do ...@@ -11,7 +11,7 @@ describe Groups::Settings::CiCdController do
describe 'GET #show' do describe 'GET #show' do
it 'renders show with 200 status code' 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 have_gitlab_http_status(200)
expect(response).to render_template(:show) expect(response).to render_template(:show)
...@@ -19,7 +19,7 @@ describe Groups::Settings::CiCdController do ...@@ -19,7 +19,7 @@ describe Groups::Settings::CiCdController do
end end
describe 'PUT #reset_registration_token' do 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 it 'resets runner registration token' do
expect { subject }.to change { group.reload.runners_token } expect { subject }.to change { group.reload.runners_token }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Groups::SharedProjectsController do describe Groups::SharedProjectsController do
def get_shared_projects(params = {}) 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 end
def share_project(project) def share_project(project)
......
...@@ -15,6 +15,6 @@ describe Groups::UploadsController do ...@@ -15,6 +15,6 @@ describe Groups::UploadsController do
def post_authorize(verified: true) def post_authorize(verified: true)
request.headers.merge!(workhorse_internal_api_request_header) if verified 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
end end
...@@ -13,7 +13,7 @@ describe Groups::VariablesController do ...@@ -13,7 +13,7 @@ describe Groups::VariablesController do
let!(:variable) { create(:ci_group_variable, group: group) } let!(:variable) { create(:ci_group_variable, group: group) }
subject do subject do
get :show, group_id: group, format: :json get :show, params: { group_id: group }, format: :json
end end
include_examples 'GET #show lists all variables' include_examples 'GET #show lists all variables'
...@@ -25,8 +25,10 @@ describe Groups::VariablesController do ...@@ -25,8 +25,10 @@ describe Groups::VariablesController do
subject do subject do
patch :update, patch :update,
group_id: group, params: {
variables_attributes: variables_attributes, group_id: group,
variables_attributes: variables_attributes
},
format: :json format: :json
end end
......
This diff is collapsed.
...@@ -37,7 +37,7 @@ describe HealthCheckController do ...@@ -37,7 +37,7 @@ describe HealthCheckController do
end end
it 'supports passing the token in query params' do 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).to be_success
expect(response.content_type).to eq 'text/plain' expect(response.content_type).to eq 'text/plain'
...@@ -74,7 +74,7 @@ describe HealthCheckController do ...@@ -74,7 +74,7 @@ describe HealthCheckController do
end end
it 'supports successful responses for specific checks' do 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).to be_success
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
...@@ -124,7 +124,7 @@ describe HealthCheckController do ...@@ -124,7 +124,7 @@ describe HealthCheckController do
end end
it 'supports failure responses for specific checks' do 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).to have_gitlab_http_status(500)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
......
...@@ -18,7 +18,7 @@ describe HealthController do ...@@ -18,7 +18,7 @@ describe HealthController do
shared_context 'endpoint responding with readiness data' do shared_context 'endpoint responding with readiness data' do
let(:request_params) { {} } let(:request_params) { {} }
subject { get :readiness, request_params } subject { get :readiness, params: request_params }
it 'responds with readiness checks data' do it 'responds with readiness checks data' do
subject subject
...@@ -112,7 +112,7 @@ describe HealthController do ...@@ -112,7 +112,7 @@ describe HealthController do
context 'token passed as URL param' do context 'token passed as URL param' do
it_behaves_like 'endpoint responding with liveness data' do it_behaves_like 'endpoint responding with liveness data' do
subject { get :liveness, token: token } subject { get :liveness, params: { token: token } }
end end
end end
end end
......
...@@ -43,7 +43,7 @@ describe HelpController do ...@@ -43,7 +43,7 @@ describe HelpController do
context 'for Markdown formats' do context 'for Markdown formats' do
context 'when requested file exists' do context 'when requested file exists' do
before do before do
get :show, path: 'ssh/README', format: :md get :show, params: { path: 'ssh/README' }, format: :md
end end
it 'assigns to @markdown' do it 'assigns to @markdown' do
...@@ -58,7 +58,7 @@ describe HelpController do ...@@ -58,7 +58,7 @@ describe HelpController do
context 'when requested file is missing' do context 'when requested file is missing' do
it 'renders not found' 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 expect(response).to be_not_found
end end
end end
...@@ -68,7 +68,9 @@ describe HelpController do ...@@ -68,7 +68,9 @@ describe HelpController do
context 'when requested file exists' do context 'when requested file exists' do
it 'renders the raw file' do it 'renders the raw file' do
get :show, get :show,
path: 'user/project/img/labels_default', params: {
path: 'user/project/img/labels_default'
},
format: :png format: :png
expect(response).to be_success expect(response).to be_success
expect(response.content_type).to eq 'image/png' expect(response.content_type).to eq 'image/png'
...@@ -79,7 +81,9 @@ describe HelpController do ...@@ -79,7 +81,9 @@ describe HelpController do
context 'when requested file is missing' do context 'when requested file is missing' do
it 'renders not found' do it 'renders not found' do
get :show, get :show,
path: 'foo/bar', params: {
path: 'foo/bar'
},
format: :png format: :png
expect(response).to be_not_found expect(response).to be_not_found
end end
...@@ -89,7 +93,9 @@ describe HelpController do ...@@ -89,7 +93,9 @@ describe HelpController do
context 'for other formats' do context 'for other formats' do
it 'always renders not found' do it 'always renders not found' do
get :show, get :show,
path: 'ssh/README', params: {
path: 'ssh/README'
},
format: :foo format: :foo
expect(response).to be_not_found expect(response).to be_not_found
end end
......
...@@ -237,7 +237,7 @@ describe Import::BitbucketController do ...@@ -237,7 +237,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, nested_namespace, user, access_params) .to receive(:new).with(bitbucket_repo, test_name, nested_namespace, user, access_params)
.and_return(double(execute: project)) .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
end end
...@@ -249,7 +249,7 @@ describe Import::BitbucketController do ...@@ -249,7 +249,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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 end
it 'creates the namespaces' do it 'creates the namespaces' do
...@@ -257,7 +257,7 @@ describe Import::BitbucketController do ...@@ -257,7 +257,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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) .to change { Namespace.count }.by(2)
end end
...@@ -266,7 +266,7 @@ describe Import::BitbucketController do ...@@ -266,7 +266,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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') expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo')
end end
...@@ -285,7 +285,7 @@ describe Import::BitbucketController do ...@@ -285,7 +285,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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 end
it 'creates the namespaces' do it 'creates the namespaces' do
...@@ -293,7 +293,7 @@ describe Import::BitbucketController do ...@@ -293,7 +293,7 @@ describe Import::BitbucketController do
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params) .to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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) .to change { Namespace.count }.by(2)
end end
end end
...@@ -302,7 +302,7 @@ describe Import::BitbucketController do ...@@ -302,7 +302,7 @@ describe Import::BitbucketController do
it 'returns 422 response' do it 'returns 422 response' do
other_namespace = create(:group, name: 'other_namespace') 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) expect(response).to have_gitlab_http_status(422)
end end
......
...@@ -42,19 +42,19 @@ describe Import::BitbucketServerController do ...@@ -42,19 +42,19 @@ describe Import::BitbucketServerController do
.to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything) .to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything)
.and_return(double(execute: project)) .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) expect(response).to have_gitlab_http_status(200)
end end
it 'returns an error when an invalid project key is used' do 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) expect(response).to have_gitlab_http_status(422)
end end
it 'returns an error when an invalid repository slug is used' do 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) expect(response).to have_gitlab_http_status(422)
end end
...@@ -62,7 +62,7 @@ describe Import::BitbucketServerController do ...@@ -62,7 +62,7 @@ describe Import::BitbucketServerController do
it 'returns an error when the project cannot be found' 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) 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) expect(response).to have_gitlab_http_status(422)
end end
...@@ -72,7 +72,7 @@ describe Import::BitbucketServerController do ...@@ -72,7 +72,7 @@ describe Import::BitbucketServerController do
.to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything) .to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything)
.and_return(double(execute: build(:project))) .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) expect(response).to have_gitlab_http_status(422)
end end
...@@ -80,7 +80,7 @@ describe Import::BitbucketServerController do ...@@ -80,7 +80,7 @@ describe Import::BitbucketServerController do
it "returns an error when the server can't be contacted" 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) 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) expect(response).to have_gitlab_http_status(422)
end end
...@@ -103,7 +103,7 @@ describe Import::BitbucketServerController do ...@@ -103,7 +103,7 @@ describe Import::BitbucketServerController do
end end
it 'sets the session variables' do 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_url]).to eq(url)
expect(session[:bitbucket_server_username]).to eq(username) expect(session[:bitbucket_server_username]).to eq(username)
......
...@@ -209,7 +209,7 @@ describe Import::GitlabController do ...@@ -209,7 +209,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, nested_namespace, user, access_params) .to receive(:new).with(gitlab_repo, nested_namespace, user, access_params)
.and_return(double(execute: project)) .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
end end
...@@ -221,7 +221,7 @@ describe Import::GitlabController do ...@@ -221,7 +221,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .and_return(double(execute: project))
post :create, { target_namespace: 'foo/bar', format: :json } post :create, params: { target_namespace: 'foo/bar' }, format: :json
end end
it 'creates the namespaces' do it 'creates the namespaces' do
...@@ -229,7 +229,7 @@ describe Import::GitlabController do ...@@ -229,7 +229,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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) .to change { Namespace.count }.by(2)
end end
...@@ -238,7 +238,7 @@ describe Import::GitlabController do ...@@ -238,7 +238,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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') expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo')
end end
...@@ -257,7 +257,7 @@ describe Import::GitlabController do ...@@ -257,7 +257,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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 end
it 'creates the namespaces' do it 'creates the namespaces' do
...@@ -265,7 +265,7 @@ describe Import::GitlabController do ...@@ -265,7 +265,7 @@ describe Import::GitlabController do
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params) .to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
.and_return(double(execute: project)) .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) .to change { Namespace.count }.by(2)
end end
end end
...@@ -274,7 +274,7 @@ describe Import::GitlabController do ...@@ -274,7 +274,7 @@ describe Import::GitlabController do
it 'returns 422 response' do it 'returns 422 response' do
other_namespace = create(:group, name: 'other_namespace') 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) expect(response).to have_gitlab_http_status(422)
end end
......
...@@ -12,14 +12,14 @@ describe Import::GitlabProjectsController do ...@@ -12,14 +12,14 @@ describe Import::GitlabProjectsController do
describe 'POST create' do describe 'POST create' do
context 'with an invalid path' do context 'with an invalid path' do
it 'redirects with an error' 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(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
end end
it 'redirects with an error when a relative path is used' do 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(flash[:alert]).to start_with('Project could not be imported')
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -28,7 +28,7 @@ describe Import::GitlabProjectsController do ...@@ -28,7 +28,7 @@ describe Import::GitlabProjectsController do
context 'with a valid path' do context 'with a valid path' do
it 'redirects to the new project 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(flash[:notice]).to include('is being imported')
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
......
...@@ -12,7 +12,7 @@ describe Import::GoogleCodeController do ...@@ -12,7 +12,7 @@ describe Import::GoogleCodeController do
describe "POST callback" do describe "POST callback" do
it "stores Google Takeout dump list in session" 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]).to be_a(Hash)
expect(session[:google_code_dump]["kind"]).to eq("projecthosting#user") expect(session[:google_code_dump]["kind"]).to eq("projecthosting#user")
......
...@@ -12,7 +12,7 @@ describe InvitesController do ...@@ -12,7 +12,7 @@ describe InvitesController do
describe 'GET #accept' do describe 'GET #accept' do
it 'accepts user' do it 'accepts user' do
get :accept, id: token get :accept, params: { id: token }
member.reload member.reload
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -23,7 +23,7 @@ describe InvitesController do ...@@ -23,7 +23,7 @@ describe InvitesController do
describe 'GET #decline' do describe 'GET #decline' do
it 'declines user' do it 'declines user' do
get :decline, id: token get :decline, params: { id: token }
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound expect {member.reload}.to raise_error ActiveRecord::RecordNotFound
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
......
...@@ -11,7 +11,7 @@ describe Ldap::OmniauthCallbacksController do ...@@ -11,7 +11,7 @@ describe Ldap::OmniauthCallbacksController do
it 'respects remember me checkbox' do it 'respects remember me checkbox' do
expect 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.to change { user.reload.remember_created_at }.from(nil)
end end
...@@ -19,7 +19,7 @@ describe Ldap::OmniauthCallbacksController do ...@@ -19,7 +19,7 @@ describe Ldap::OmniauthCallbacksController do
let(:user) { create(:omniauth_user, :two_factor_via_otp, extern_uid: uid, provider: provider) } let(:user) { create(:omniauth_user, :two_factor_via_otp, extern_uid: uid, provider: provider) }
it 'passes remember_me to the Devise view' do 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' expect(assigns[:user].remember_me).to eq '1'
end end
......
...@@ -13,8 +13,10 @@ describe NotificationSettingsController do ...@@ -13,8 +13,10 @@ describe NotificationSettingsController do
context 'when not authorized' do context 'when not authorized' do
it 'redirects to sign in page' do it 'redirects to sign in page' do
post :create, post :create,
project_id: project.id, params: {
notification_setting: { level: :participating } project_id: project.id,
notification_setting: { level: :participating }
}
expect(response).to redirect_to(new_user_session_path) expect(response).to redirect_to(new_user_session_path)
end end
...@@ -41,8 +43,10 @@ describe NotificationSettingsController do ...@@ -41,8 +43,10 @@ describe NotificationSettingsController do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
project_id: project.id, params: {
notification_setting: { level: :participating } project_id: project.id,
notification_setting: { level: :participating }
}
expect(response.status).to eq 200 expect(response.status).to eq 200
expect(notification_setting.level).to eq("participating") expect(notification_setting.level).to eq("participating")
...@@ -54,8 +58,10 @@ describe NotificationSettingsController do ...@@ -54,8 +58,10 @@ describe NotificationSettingsController do
context 'with custom settings' do context 'with custom settings' do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
project_id: project.id, params: {
notification_setting: { level: :custom }.merge(custom_events) project_id: project.id,
notification_setting: { level: :custom }.merge(custom_events)
}
expect(response.status).to eq 200 expect(response.status).to eq 200
expect(notification_setting.level).to eq("custom") expect(notification_setting.level).to eq("custom")
...@@ -72,8 +78,10 @@ describe NotificationSettingsController do ...@@ -72,8 +78,10 @@ describe NotificationSettingsController do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
namespace_id: group.id, params: {
notification_setting: { level: :watch } namespace_id: group.id,
notification_setting: { level: :watch }
}
expect(response.status).to eq 200 expect(response.status).to eq 200
expect(notification_setting.level).to eq("watch") expect(notification_setting.level).to eq("watch")
...@@ -85,8 +93,10 @@ describe NotificationSettingsController do ...@@ -85,8 +93,10 @@ describe NotificationSettingsController do
context 'with custom settings' do context 'with custom settings' do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
namespace_id: group.id, params: {
notification_setting: { level: :custom }.merge(custom_events) namespace_id: group.id,
notification_setting: { level: :custom }.merge(custom_events)
}
expect(response.status).to eq 200 expect(response.status).to eq 200
expect(notification_setting.level).to eq("custom") expect(notification_setting.level).to eq("custom")
...@@ -108,8 +118,10 @@ describe NotificationSettingsController do ...@@ -108,8 +118,10 @@ describe NotificationSettingsController do
it 'returns 404' do it 'returns 404' do
post :create, post :create,
project_id: private_project.id, params: {
notification_setting: { level: :participating } project_id: private_project.id,
notification_setting: { level: :participating }
}
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -122,8 +134,10 @@ describe NotificationSettingsController do ...@@ -122,8 +134,10 @@ describe NotificationSettingsController do
context 'when not authorized' do context 'when not authorized' do
it 'redirects to sign in page' do it 'redirects to sign in page' do
put :update, put :update,
id: notification_setting, params: {
notification_setting: { level: :participating } id: notification_setting,
notification_setting: { level: :participating }
}
expect(response).to redirect_to(new_user_session_path) expect(response).to redirect_to(new_user_session_path)
end end
...@@ -136,8 +150,10 @@ describe NotificationSettingsController do ...@@ -136,8 +150,10 @@ describe NotificationSettingsController do
it 'returns success' do it 'returns success' do
put :update, put :update,
id: notification_setting, params: {
notification_setting: { level: :participating } id: notification_setting,
notification_setting: { level: :participating }
}
expect(response.status).to eq 200 expect(response.status).to eq 200
end end
...@@ -153,8 +169,10 @@ describe NotificationSettingsController do ...@@ -153,8 +169,10 @@ describe NotificationSettingsController do
it 'returns success' do it 'returns success' do
put :update, put :update,
id: notification_setting, params: {
notification_setting: { level: :participating, events: custom_events } id: notification_setting,
notification_setting: { level: :participating, events: custom_events }
}
expect(response.status).to eq 200 expect(response.status).to eq 200
end end
...@@ -170,8 +188,10 @@ describe NotificationSettingsController do ...@@ -170,8 +188,10 @@ describe NotificationSettingsController do
it 'returns 404' do it 'returns 404' do
put :update, put :update,
id: notification_setting, params: {
notification_setting: { level: :participating } id: notification_setting,
notification_setting: { level: :participating }
}
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
......
...@@ -26,7 +26,7 @@ describe Oauth::ApplicationsController do ...@@ -26,7 +26,7 @@ describe Oauth::ApplicationsController do
describe 'POST #create' do describe 'POST #create' do
it 'creates an application' 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 have_gitlab_http_status(302)
expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last)) expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last))
...@@ -35,7 +35,7 @@ describe Oauth::ApplicationsController do ...@@ -35,7 +35,7 @@ describe Oauth::ApplicationsController do
it 'redirects back to profile page if OAuth applications are disabled' do it 'redirects back to profile page if OAuth applications are disabled' do
disable_user_oauth disable_user_oauth
post :create, oauth_params post :create, params: oauth_params
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
expect(response).to redirect_to(profile_path) expect(response).to redirect_to(profile_path)
...@@ -52,7 +52,7 @@ describe Oauth::ApplicationsController do ...@@ -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' expect(response.body).to include 'Redirect URI is forbidden by the server'
end end
......
...@@ -30,7 +30,7 @@ describe Oauth::AuthorizationsController do ...@@ -30,7 +30,7 @@ describe Oauth::AuthorizationsController do
render_views render_views
it 'returns 200 code and renders view' do 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 have_gitlab_http_status(200)
expect(response).to render_template('doorkeeper/authorizations/new') expect(response).to render_template('doorkeeper/authorizations/new')
...@@ -40,7 +40,7 @@ describe Oauth::AuthorizationsController do ...@@ -40,7 +40,7 @@ describe Oauth::AuthorizationsController do
application.update(trusted: true) application.update(trusted: true)
request.session['user_return_to'] = 'http://example.com' 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(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -57,7 +57,7 @@ describe Oauth::AuthorizationsController do ...@@ -57,7 +57,7 @@ describe Oauth::AuthorizationsController do
end end
it 'authorizes the request and redirects' do it 'authorizes the request and redirects' do
get :new, params get :new, params: params
expect(request.session['user_return_to']).to be_nil expect(request.session['user_return_to']).to be_nil
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
......
...@@ -22,7 +22,7 @@ describe PasswordsController do ...@@ -22,7 +22,7 @@ describe PasswordsController do
let(:user) { create(:omniauth_user, provider: 'ldapmain', email: 'ldapuser@gitlab.com') } let(:user) { create(:omniauth_user, provider: 'ldapmain', email: 'ldapuser@gitlab.com') }
it 'prevents a password reset' do 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.' expect(flash[:alert]).to eq 'Password authentication is unavailable.'
end end
......
...@@ -9,7 +9,7 @@ describe Profiles::AccountsController do ...@@ -9,7 +9,7 @@ describe Profiles::AccountsController do
end end
it 'renders 404 if someone tries to unlink a non existent provider' do 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -21,7 +21,7 @@ describe Profiles::AccountsController do ...@@ -21,7 +21,7 @@ describe Profiles::AccountsController do
it "does not allow to unlink connected account" do it "does not allow to unlink connected account" do
identity = user.identities.last 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(response).to have_gitlab_http_status(302)
expect(user.reload.identities).to include(identity) expect(user.reload.identities).to include(identity)
...@@ -36,7 +36,7 @@ describe Profiles::AccountsController do ...@@ -36,7 +36,7 @@ describe Profiles::AccountsController do
it 'allows to unlink connected account' do it 'allows to unlink connected account' do
identity = user.identities.last 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(response).to have_gitlab_http_status(302)
expect(user.reload.identities).not_to include(identity) expect(user.reload.identities).not_to include(identity)
......
...@@ -11,7 +11,7 @@ describe Profiles::EmailsController do ...@@ -11,7 +11,7 @@ describe Profiles::EmailsController do
let(:email_params) { { email: "add_email@example.com" } } let(:email_params) { { email: "add_email@example.com" } }
it 'sends an email confirmation' do 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.to).to eq [email_params[:email]]
expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions" expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions"
end end
...@@ -23,13 +23,13 @@ describe Profiles::EmailsController do ...@@ -23,13 +23,13 @@ describe Profiles::EmailsController do
it 'resends an email confirmation' do it 'resends an email confirmation' do
email = user.emails.create(email: 'add_email@example.com') 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.to).to eq [email_params[:email]]
expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions" expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions"
end end
it 'unable to resend an email confirmation' do 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 end
end end
...@@ -6,7 +6,7 @@ describe Profiles::KeysController do ...@@ -6,7 +6,7 @@ describe Profiles::KeysController do
describe "#get_keys" do describe "#get_keys" do
describe "non existent user" do describe "non existent user" do
it "does not generally work" 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 expect(response).not_to be_success
end end
...@@ -14,19 +14,19 @@ describe Profiles::KeysController do ...@@ -14,19 +14,19 @@ describe Profiles::KeysController do
describe "user with no keys" do describe "user with no keys" do
it "does generally work" do it "does generally work" do
get :get_keys, username: user.username get :get_keys, params: { username: user.username }
expect(response).to be_success expect(response).to be_success
end end
it "renders all keys separated with a new line" do 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("") expect(response.body).to eq("")
end end
it "responds with text/plain content type" do 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") expect(response.content_type).to eq("text/plain")
end end
end end
...@@ -37,13 +37,13 @@ describe Profiles::KeysController do ...@@ -37,13 +37,13 @@ describe Profiles::KeysController do
let!(:deploy_key) { create(:deploy_key, user: user) } let!(:deploy_key) { create(:deploy_key, user: user) }
it "does generally work" do it "does generally work" do
get :get_keys, username: user.username get :get_keys, params: { username: user.username }
expect(response).to be_success expect(response).to be_success
end end
it "renders all non deploy keys separated with a new line" do 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).not_to eq('')
expect(response.body).to eq(user.all_ssh_keys.join("\n")) expect(response.body).to eq(user.all_ssh_keys.join("\n"))
...@@ -55,13 +55,13 @@ describe Profiles::KeysController do ...@@ -55,13 +55,13 @@ describe Profiles::KeysController do
end end
it "does not render the comment of the key" do 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/) expect(response.body).not_to match(/dummy@gitlab.com/)
end end
it "responds with text/plain content type" do 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") expect(response.content_type).to eq("text/plain")
end end
......
...@@ -24,7 +24,7 @@ describe Profiles::NotificationsController do ...@@ -24,7 +24,7 @@ describe Profiles::NotificationsController do
it 'updates only permitted attributes' do it 'updates only permitted attributes' do
sign_in(user) 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 user.reload
expect(user.notification_email).to eq('new@example.com') expect(user.notification_email).to eq('new@example.com')
...@@ -36,7 +36,7 @@ describe Profiles::NotificationsController do ...@@ -36,7 +36,7 @@ describe Profiles::NotificationsController do
it 'shows an error message if the params are invalid' do it 'shows an error message if the params are invalid' do
sign_in(user) 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(user.reload.notification_email).to eq('original@example.com')
expect(controller).to set_flash[:alert].to('Failed to save new settings') expect(controller).to set_flash[:alert].to('Failed to save new settings')
......
...@@ -17,7 +17,7 @@ describe Profiles::PersonalAccessTokensController do ...@@ -17,7 +17,7 @@ describe Profiles::PersonalAccessTokensController do
name = 'My PAT' name = 'My PAT'
scopes = %w[api read_user] 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).not_to be_nil
expect(created_token.name).to eq(name) expect(created_token.name).to eq(name)
...@@ -28,7 +28,7 @@ describe Profiles::PersonalAccessTokensController do ...@@ -28,7 +28,7 @@ describe Profiles::PersonalAccessTokensController do
it "allows creation of a token with an expiry date" do it "allows creation of a token with an expiry date" do
expires_at = 5.days.from_now.to_date 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).not_to be_nil
expect(created_token.expires_at).to eq(expires_at) expect(created_token.expires_at).to eq(expires_at)
......
...@@ -29,7 +29,7 @@ describe Profiles::PreferencesController do ...@@ -29,7 +29,7 @@ describe Profiles::PreferencesController do
theme_id: '1' theme_id: '1'
) )
patch :update, user: params, format: format patch :update, params: { user: params }, format: format
end end
context 'on successful update' do context 'on successful update' do
......
...@@ -32,7 +32,7 @@ describe Profiles::TwoFactorAuthsController do ...@@ -32,7 +32,7 @@ describe Profiles::TwoFactorAuthsController do
let(:pin) { 'pin-code' } let(:pin) { 'pin-code' }
def go def go
post :create, pin_code: pin post :create, params: { pin_code: pin }
end end
context 'with valid pin' do context 'with valid pin' do
......
...@@ -9,7 +9,7 @@ describe ProfilesController, :request_store do ...@@ -9,7 +9,7 @@ describe ProfilesController, :request_store do
expect do expect do
post :update, post :update,
user: { password: 'hello12345', password_confirmation: 'hello12345' } params: { user: { password: 'hello12345', password_confirmation: 'hello12345' } }
end.not_to change { user.reload.encrypted_password } end.not_to change { user.reload.encrypted_password }
expect(response.status).to eq(302) expect(response.status).to eq(302)
...@@ -21,7 +21,7 @@ describe ProfilesController, :request_store do ...@@ -21,7 +21,7 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update, put :update,
user: { email: "john@gmail.com", name: "John" } params: { user: { email: "john@gmail.com", name: "John" } }
user.reload user.reload
...@@ -35,7 +35,7 @@ describe ProfilesController, :request_store do ...@@ -35,7 +35,7 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update, put :update,
user: { email: "john@gmail.com", name: "John" } params: { user: { email: "john@gmail.com", name: "John" } }
user.reload user.reload
...@@ -52,7 +52,7 @@ describe ProfilesController, :request_store do ...@@ -52,7 +52,7 @@ describe ProfilesController, :request_store do
sign_in(ldap_user) sign_in(ldap_user)
put :update, put :update,
user: { email: "john@gmail.com", name: "John" } params: { user: { email: "john@gmail.com", name: "John" } }
ldap_user.reload ldap_user.reload
...@@ -69,7 +69,7 @@ describe ProfilesController, :request_store do ...@@ -69,7 +69,7 @@ describe ProfilesController, :request_store do
sign_in(ldap_user) sign_in(ldap_user)
put :update, 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 ldap_user.reload
...@@ -82,7 +82,7 @@ describe ProfilesController, :request_store do ...@@ -82,7 +82,7 @@ describe ProfilesController, :request_store do
it 'allows setting a user status' do it 'allows setting a user status' do
sign_in(user) 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(user.reload.status.message).to eq('Working hard!')
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -98,7 +98,7 @@ describe ProfilesController, :request_store do ...@@ -98,7 +98,7 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update_username, put :update_username,
user: { username: new_username } params: { user: { username: new_username } }
user.reload user.reload
...@@ -110,7 +110,9 @@ describe ProfilesController, :request_store do ...@@ -110,7 +110,9 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update_username, put :update_username,
user: { username: new_username }, params: {
user: { username: new_username }
},
format: :json format: :json
expect(response.status).to eq(200) expect(response.status).to eq(200)
...@@ -121,7 +123,9 @@ describe ProfilesController, :request_store do ...@@ -121,7 +123,9 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update_username, put :update_username,
user: { username: 'invalid username.git' }, params: {
user: { username: 'invalid username.git' }
},
format: :json format: :json
expect(response.status).to eq(422) expect(response.status).to eq(422)
...@@ -131,7 +135,7 @@ describe ProfilesController, :request_store do ...@@ -131,7 +135,7 @@ describe ProfilesController, :request_store do
it 'raises a correct error when the username is missing' do it 'raises a correct error when the username is missing' do
sign_in(user) 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) .to raise_error(ActionController::ParameterMissing)
end end
...@@ -142,7 +146,7 @@ describe ProfilesController, :request_store do ...@@ -142,7 +146,7 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update_username, put :update_username,
user: { username: new_username } params: { user: { username: new_username } }
user.reload user.reload
...@@ -160,7 +164,7 @@ describe ProfilesController, :request_store do ...@@ -160,7 +164,7 @@ describe ProfilesController, :request_store do
sign_in(user) sign_in(user)
put :update_username, put :update_username,
user: { username: new_username } params: { user: { username: new_username } }
user.reload user.reload
......
...@@ -22,7 +22,7 @@ describe Projects::ArtifactsController do ...@@ -22,7 +22,7 @@ describe Projects::ArtifactsController do
def download_artifact(extra_params = {}) def download_artifact(extra_params = {})
params = { namespace_id: project.namespace, project_id: project, job_id: job }.merge(extra_params) params = { namespace_id: project.namespace, project_id: project, job_id: job }.merge(extra_params)
get :download, params get :download, params: params
end end
context 'when no file type is supplied' do context 'when no file type is supplied' do
...@@ -86,7 +86,7 @@ describe Projects::ArtifactsController do ...@@ -86,7 +86,7 @@ describe Projects::ArtifactsController do
describe 'GET browse' do describe 'GET browse' do
context 'when the directory exists' do context 'when the directory exists' do
it 'renders the browse view' 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') expect(response).to render_template('projects/artifacts/browse')
end end
...@@ -94,7 +94,7 @@ describe Projects::ArtifactsController do ...@@ -94,7 +94,7 @@ describe Projects::ArtifactsController do
context 'when the directory does not exist' do context 'when the directory does not exist' do
it 'responds Not Found' 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 expect(response).to be_not_found
end end
...@@ -113,7 +113,7 @@ describe Projects::ArtifactsController do ...@@ -113,7 +113,7 @@ describe Projects::ArtifactsController do
context 'when the file exists' do context 'when the file exists' do
it 'renders the file view' 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) expect(response).to have_gitlab_http_status(302)
end end
...@@ -121,7 +121,7 @@ describe Projects::ArtifactsController do ...@@ -121,7 +121,7 @@ describe Projects::ArtifactsController do
context 'when the file does not exist' do context 'when the file does not exist' do
it 'responds Not Found' 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 expect(response).to be_not_found
end end
...@@ -131,7 +131,7 @@ describe Projects::ArtifactsController do ...@@ -131,7 +131,7 @@ describe Projects::ArtifactsController do
context 'when the file is served through Rails' do context 'when the file is served through Rails' do
context 'when the file exists' do context 'when the file exists' do
it 'renders the file view' 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 have_gitlab_http_status(:ok)
expect(response).to render_template('projects/artifacts/file') expect(response).to render_template('projects/artifacts/file')
...@@ -140,7 +140,7 @@ describe Projects::ArtifactsController do ...@@ -140,7 +140,7 @@ describe Projects::ArtifactsController do
context 'when the file does not exist' do context 'when the file does not exist' do
it 'responds Not Found' 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 expect(response).to be_not_found
end end
...@@ -159,7 +159,7 @@ describe Projects::ArtifactsController do ...@@ -159,7 +159,7 @@ describe Projects::ArtifactsController do
end end
it 'does not redirect the request' do 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 have_gitlab_http_status(:ok)
expect(response).to render_template('projects/artifacts/file') expect(response).to render_template('projects/artifacts/file')
...@@ -168,7 +168,7 @@ describe Projects::ArtifactsController do ...@@ -168,7 +168,7 @@ describe Projects::ArtifactsController do
end end
describe 'GET raw' do 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 context 'when the file exists' do
let(:path) { 'ci_artifacts.txt' } let(:path) { 'ci_artifacts.txt' }
...@@ -239,7 +239,7 @@ describe Projects::ArtifactsController do ...@@ -239,7 +239,7 @@ describe Projects::ArtifactsController do
context 'has no such ref' do context 'has no such ref' do
before do before do
get :latest_succeeded, params_from_ref('TAIL', job.name) get :latest_succeeded, params: params_from_ref('TAIL', job.name)
end end
it_behaves_like 'not found' it_behaves_like 'not found'
...@@ -247,7 +247,7 @@ describe Projects::ArtifactsController do ...@@ -247,7 +247,7 @@ describe Projects::ArtifactsController do
context 'has no such job' do context 'has no such job' do
before do before do
get :latest_succeeded, params_from_ref(pipeline.ref, 'NOBUILD') get :latest_succeeded, params: params_from_ref(pipeline.ref, 'NOBUILD')
end end
it_behaves_like 'not found' it_behaves_like 'not found'
...@@ -255,7 +255,7 @@ describe Projects::ArtifactsController do ...@@ -255,7 +255,7 @@ describe Projects::ArtifactsController do
context 'has no path' do context 'has no path' do
before 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 end
it_behaves_like 'not found' it_behaves_like 'not found'
...@@ -276,7 +276,7 @@ describe Projects::ArtifactsController do ...@@ -276,7 +276,7 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'master', pipeline.update(ref: 'master',
sha: project.commit('master').sha) sha: project.commit('master').sha)
get :latest_succeeded, params_from_ref('master') get :latest_succeeded, params: params_from_ref('master')
end end
it_behaves_like 'redirect to the job' it_behaves_like 'redirect to the job'
...@@ -287,7 +287,7 @@ describe Projects::ArtifactsController do ...@@ -287,7 +287,7 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'improve/awesome', pipeline.update(ref: 'improve/awesome',
sha: project.commit('improve/awesome').sha) sha: project.commit('improve/awesome').sha)
get :latest_succeeded, params_from_ref('improve/awesome') get :latest_succeeded, params: params_from_ref('improve/awesome')
end end
it_behaves_like 'redirect to the job' it_behaves_like 'redirect to the job'
...@@ -298,7 +298,7 @@ describe Projects::ArtifactsController do ...@@ -298,7 +298,7 @@ describe Projects::ArtifactsController do
pipeline.update(ref: 'improve/awesome', pipeline.update(ref: 'improve/awesome',
sha: project.commit('improve/awesome').sha) 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 end
it 'redirects' do it 'redirects' do
......
...@@ -8,7 +8,7 @@ describe Projects::AvatarsController do ...@@ -8,7 +8,7 @@ describe Projects::AvatarsController do
end end
describe 'GET #show' do 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 context 'when repository has no avatar' do
it 'shows 404' do it 'shows 404' do
...@@ -71,7 +71,7 @@ describe Projects::AvatarsController do ...@@ -71,7 +71,7 @@ describe Projects::AvatarsController do
describe 'DELETE #destroy' do describe 'DELETE #destroy' do
it 'removes avatar from DB by calling 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.avatar.present?).to be_falsey
expect(project).to be_valid expect(project).to be_valid
......
...@@ -23,6 +23,6 @@ describe Projects::BadgesController do ...@@ -23,6 +23,6 @@ describe Projects::BadgesController do
end end
def get_badge(badge) 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
end end
...@@ -16,9 +16,11 @@ describe Projects::BlameController do ...@@ -16,9 +16,11 @@ describe Projects::BlameController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id) project_id: project,
id: id
})
end end
context "valid file" do context "valid file" do
......
...@@ -11,9 +11,11 @@ describe Projects::BlobController do ...@@ -11,9 +11,11 @@ describe Projects::BlobController do
context 'with file path' do context 'with file path' do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id) project_id: project,
id: id
})
end end
context "valid branch, valid file" do context "valid branch, valid file" do
...@@ -48,9 +50,11 @@ describe Projects::BlobController do ...@@ -48,9 +50,11 @@ describe Projects::BlobController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id, project_id: project,
id: id
},
format: :json) format: :json)
end end
...@@ -66,11 +70,13 @@ describe Projects::BlobController do ...@@ -66,11 +70,13 @@ describe Projects::BlobController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id, project_id: project,
format: :json, id: id,
viewer: 'none') viewer: 'none'
},
format: :json)
end end
it do it do
...@@ -84,9 +90,11 @@ describe Projects::BlobController do ...@@ -84,9 +90,11 @@ describe Projects::BlobController do
context 'with tree path' do context 'with tree path' do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id) project_id: project,
id: id
})
controller.instance_variable_set(:@blob, nil) controller.instance_variable_set(:@blob, nil)
end end
...@@ -109,7 +117,7 @@ describe Projects::BlobController do ...@@ -109,7 +117,7 @@ describe Projects::BlobController do
params = { namespace_id: project.namespace, params = { namespace_id: project.namespace,
project_id: project, project_id: project,
id: 'master/CHANGELOG' } id: 'master/CHANGELOG' }
get :diff, params.merge(opts) get :diff, params: params.merge(opts)
end end
before do before do
...@@ -200,7 +208,7 @@ describe Projects::BlobController do ...@@ -200,7 +208,7 @@ describe Projects::BlobController do
context 'anonymous' do context 'anonymous' do
before do before do
get :edit, default_params get :edit, params: default_params
end end
it 'redirects to sign in and returns' do it 'redirects to sign in and returns' do
...@@ -213,7 +221,7 @@ describe Projects::BlobController do ...@@ -213,7 +221,7 @@ describe Projects::BlobController do
before do before do
sign_in(guest) sign_in(guest)
get :edit, default_params get :edit, params: default_params
end end
it 'redirects to blob show' do it 'redirects to blob show' do
...@@ -227,7 +235,7 @@ describe Projects::BlobController do ...@@ -227,7 +235,7 @@ describe Projects::BlobController do
before do before do
project.add_developer(developer) project.add_developer(developer)
sign_in(developer) sign_in(developer)
get :edit, default_params get :edit, params: default_params
end end
it 'redirects to blob show' do it 'redirects to blob show' do
...@@ -241,7 +249,7 @@ describe Projects::BlobController do ...@@ -241,7 +249,7 @@ describe Projects::BlobController do
before do before do
project.add_maintainer(maintainer) project.add_maintainer(maintainer)
sign_in(maintainer) sign_in(maintainer)
get :edit, default_params get :edit, params: default_params
end end
it 'redirects to blob show' do it 'redirects to blob show' do
...@@ -274,7 +282,7 @@ describe Projects::BlobController do ...@@ -274,7 +282,7 @@ describe Projects::BlobController do
end end
it 'redirects to blob' do it 'redirects to blob' do
put :update, default_params put :update, params: default_params
expect(response).to redirect_to(blob_after_edit_path) expect(response).to redirect_to(blob_after_edit_path)
end end
...@@ -284,7 +292,7 @@ describe Projects::BlobController do ...@@ -284,7 +292,7 @@ describe Projects::BlobController do
let(:mr_params) { default_params.merge(from_merge_request_iid: merge_request.iid) } let(:mr_params) { default_params.merge(from_merge_request_iid: merge_request.iid) }
it 'redirects to MR diff' do 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) after_edit_path = diffs_project_merge_request_path(project, merge_request)
file_anchor = "##{Digest::SHA1.hexdigest('CHANGELOG')}" file_anchor = "##{Digest::SHA1.hexdigest('CHANGELOG')}"
...@@ -298,7 +306,7 @@ describe Projects::BlobController do ...@@ -298,7 +306,7 @@ describe Projects::BlobController do
end end
it "it redirect to blob" do it "it redirect to blob" do
put :update, mr_params put :update, params: mr_params
expect(response).to redirect_to(blob_after_edit_path) expect(response).to redirect_to(blob_after_edit_path)
end end
...@@ -320,7 +328,7 @@ describe Projects::BlobController do ...@@ -320,7 +328,7 @@ describe Projects::BlobController do
end end
it 'redirects to blob' do 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')) expect(response).to redirect_to(project_blob_path(forked_project, 'master/CHANGELOG'))
end end
...@@ -331,7 +339,7 @@ describe Projects::BlobController do ...@@ -331,7 +339,7 @@ describe Projects::BlobController do
default_params[:branch_name] = "fork-test-1" default_params[:branch_name] = "fork-test-1"
default_params[:create_merge_request] = 1 default_params[:create_merge_request] = 1
put :update, default_params put :update, params: default_params
expect(response).to redirect_to( expect(response).to redirect_to(
project_new_merge_request_path( project_new_merge_request_path(
...@@ -374,7 +382,7 @@ describe Projects::BlobController do ...@@ -374,7 +382,7 @@ describe Projects::BlobController do
let(:after_delete_path) { project_tree_path(project, 'master/files') } let(:after_delete_path) { project_tree_path(project, 'master/files') }
it 'redirects to the sub directory' do it 'redirects to the sub directory' do
delete :destroy, default_params delete :destroy, params: default_params
expect(response).to redirect_to(after_delete_path) expect(response).to redirect_to(after_delete_path)
end end
...@@ -393,7 +401,7 @@ describe Projects::BlobController do ...@@ -393,7 +401,7 @@ describe Projects::BlobController do
end end
it 'redirects to the project root' do it 'redirects to the project root' do
delete :destroy, default_params delete :destroy, params: default_params
expect(response).to redirect_to(project_root_path) expect(response).to redirect_to(project_root_path)
end end
...@@ -413,7 +421,7 @@ describe Projects::BlobController do ...@@ -413,7 +421,7 @@ describe Projects::BlobController do
let(:after_delete_path) { project_tree_path(project, 'binary-encoding') } let(:after_delete_path) { project_tree_path(project, 'binary-encoding') }
it 'redirects to the project root of the branch' do 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) expect(response).to redirect_to(after_delete_path)
end end
......
...@@ -121,8 +121,10 @@ describe Projects::BoardsController do ...@@ -121,8 +121,10 @@ describe Projects::BoardsController do
end end
def list_boards(format: :html) def list_boards(format: :html)
get :index, namespace_id: project.namespace, get :index, params: {
project_id: project, namespace_id: project.namespace,
project_id: project
},
format: format format: format
end end
end end
...@@ -207,9 +209,11 @@ describe Projects::BoardsController do ...@@ -207,9 +209,11 @@ describe Projects::BoardsController do
end end
def read_board(board:, format: :html) def read_board(board:, format: :html)
get :show, namespace_id: project.namespace, get :show, params: {
project_id: project, namespace_id: project.namespace,
id: board.to_param, project_id: project,
id: board.to_param
},
format: format format: format
end end
end end
......
...@@ -22,10 +22,12 @@ describe Projects::BranchesController do ...@@ -22,10 +22,12 @@ describe Projects::BranchesController do
sign_in(user) sign_in(user)
post :create, post :create,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
branch_name: branch, project_id: project,
ref: ref branch_name: branch,
ref: ref
}
end end
context "valid branch name, valid source" do context "valid branch name, valid source" do
...@@ -76,10 +78,12 @@ describe Projects::BranchesController do ...@@ -76,10 +78,12 @@ describe Projects::BranchesController do
it 'redirects' do it 'redirects' do
post :create, post :create,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
branch_name: branch, project_id: project,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
expect(subject) expect(subject)
.to redirect_to("/#{project.full_path}/tree/1-feature-branch") .to redirect_to("/#{project.full_path}/tree/1-feature-branch")
...@@ -89,10 +93,12 @@ describe Projects::BranchesController do ...@@ -89,10 +93,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch") expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch")
post :create, post :create,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
branch_name: branch, project_id: project,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
end end
context 'repository-less project' do context 'repository-less project' do
...@@ -105,10 +111,12 @@ describe Projects::BranchesController do ...@@ -105,10 +111,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true) expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create, post :create,
namespace_id: project.namespace.to_param, params: {
project_id: project.to_param, namespace_id: project.namespace.to_param,
branch_name: branch, project_id: project.to_param,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
expect(response).to redirect_to project_tree_path(project, branch) expect(response).to redirect_to project_tree_path(project, branch)
end end
...@@ -121,10 +129,12 @@ describe Projects::BranchesController do ...@@ -121,10 +129,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true) expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create, post :create,
namespace_id: project.namespace.to_param, params: {
project_id: project.to_param, namespace_id: project.namespace.to_param,
branch_name: branch, project_id: project.to_param,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
expect(response.location).to include(project_new_blob_path(project, branch)) expect(response.location).to include(project_new_blob_path(project, branch))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -156,10 +166,12 @@ describe Projects::BranchesController do ...@@ -156,10 +166,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true) expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
post :create, post :create,
namespace_id: project.namespace.to_param, params: {
project_id: project.to_param, namespace_id: project.namespace.to_param,
branch_name: branch, project_id: project.to_param,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
expect(response.location).to include(project_new_blob_path(project, branch)) expect(response.location).to include(project_new_blob_path(project, branch))
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(302)
...@@ -173,10 +185,12 @@ describe Projects::BranchesController do ...@@ -173,10 +185,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).not_to receive(:new_issue_branch) expect(SystemNoteService).not_to receive(:new_issue_branch)
post :create, post :create,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
branch_name: branch, project_id: project,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
end end
end end
...@@ -191,10 +205,12 @@ describe Projects::BranchesController do ...@@ -191,10 +205,12 @@ describe Projects::BranchesController do
expect(SystemNoteService).not_to receive(:new_issue_branch) expect(SystemNoteService).not_to receive(:new_issue_branch)
post :create, post :create,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
branch_name: branch, project_id: project,
issue_iid: issue.iid branch_name: branch,
issue_iid: issue.iid
}
end end
end end
end end
...@@ -228,11 +244,14 @@ describe Projects::BranchesController do ...@@ -228,11 +244,14 @@ describe Projects::BranchesController do
end end
def create_branch(name:, ref:) def create_branch(name:, ref:)
post :create, namespace_id: project.namespace.to_param, post :create,
project_id: project.to_param, format: :json,
branch_name: name, params: {
ref: ref, namespace_id: project.namespace.to_param,
format: :json project_id: project.to_param,
branch_name: name,
ref: ref
}
end end
end end
...@@ -246,9 +265,11 @@ describe Projects::BranchesController do ...@@ -246,9 +265,11 @@ describe Projects::BranchesController do
it 'returns 303' do it 'returns 303' do
post :destroy, post :destroy,
format: :html, format: :html,
id: 'foo/bar/baz', params: {
namespace_id: project.namespace, id: 'foo/bar/baz',
project_id: project namespace_id: project.namespace,
project_id: project
}
expect(response).to have_gitlab_http_status(303) expect(response).to have_gitlab_http_status(303)
end end
...@@ -261,10 +282,12 @@ describe Projects::BranchesController do ...@@ -261,10 +282,12 @@ describe Projects::BranchesController do
sign_in(user) sign_in(user)
post :destroy, post :destroy,
format: format, format: format,
id: branch, params: {
namespace_id: project.namespace, id: branch,
project_id: project namespace_id: project.namespace,
project_id: project
}
end end
context 'as JS' do context 'as JS' do
...@@ -359,8 +382,10 @@ describe Projects::BranchesController do ...@@ -359,8 +382,10 @@ describe Projects::BranchesController do
describe "DELETE destroy_all_merged" do describe "DELETE destroy_all_merged" do
def destroy_all_merged def destroy_all_merged
delete :destroy_all_merged, delete :destroy_all_merged,
namespace_id: project.namespace, params: {
project_id: project namespace_id: project.namespace,
project_id: project
}
end end
context 'when user is allowed to push' do context 'when user is allowed to push' do
...@@ -404,10 +429,12 @@ describe Projects::BranchesController do ...@@ -404,10 +429,12 @@ describe Projects::BranchesController do
context 'when rendering a JSON format' do context 'when rendering a JSON format' do
it 'filters branches by name' do it 'filters branches by name' do
get :index, get :index,
namespace_id: project.namespace,
project_id: project,
format: :json, format: :json,
search: 'master' params: {
namespace_id: project.namespace,
project_id: project,
search: 'master'
}
parsed_response = JSON.parse(response.body) parsed_response = JSON.parse(response.body)
...@@ -423,10 +450,12 @@ describe Projects::BranchesController do ...@@ -423,10 +450,12 @@ describe Projects::BranchesController do
context 'when cache is enabled yet cold', :request_store do context 'when cache is enabled yet cold', :request_store do
it 'return with a status 200' do it 'return with a status 200' do
get :index, get :index,
namespace_id: project.namespace, format: :html,
project_id: project, params: {
state: 'all', namespace_id: project.namespace,
format: :html project_id: project,
state: 'all'
}
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
...@@ -439,10 +468,12 @@ describe Projects::BranchesController do ...@@ -439,10 +468,12 @@ describe Projects::BranchesController do
it 'return with a status 200' do it 'return with a status 200' do
get :index, get :index,
namespace_id: project.namespace, format: :html,
project_id: project, params: {
state: 'all', namespace_id: project.namespace,
format: :html project_id: project,
state: 'all'
}
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
...@@ -451,30 +482,36 @@ describe Projects::BranchesController do ...@@ -451,30 +482,36 @@ describe Projects::BranchesController do
context 'when deprecated sort/search/page parameters are specified' do context 'when deprecated sort/search/page parameters are specified' do
it 'returns with a status 301 when sort specified' do it 'returns with a status 301 when sort specified' do
get :index, get :index,
namespace_id: project.namespace, format: :html,
project_id: project, params: {
sort: 'updated_asc', namespace_id: project.namespace,
format: :html project_id: project,
sort: 'updated_asc'
}
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all') expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
end end
it 'returns with a status 301 when search specified' do it 'returns with a status 301 when search specified' do
get :index, get :index,
namespace_id: project.namespace, format: :html,
project_id: project, params: {
search: 'feature', namespace_id: project.namespace,
format: :html project_id: project,
search: 'feature'
}
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all') expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
end end
it 'returns with a status 301 when page specified' do it 'returns with a status 301 when page specified' do
get :index, get :index,
namespace_id: project.namespace, format: :html,
project_id: project, params: {
page: 2, namespace_id: project.namespace,
format: :html project_id: project,
page: 2
}
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all') expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
end end
......
...@@ -13,7 +13,7 @@ describe Projects::Ci::LintsController do ...@@ -13,7 +13,7 @@ describe Projects::Ci::LintsController do
before do before do
project.add_developer(user) project.add_developer(user)
get :show, namespace_id: project.namespace, project_id: project get :show, params: { namespace_id: project.namespace, project_id: project }
end end
it 'should be success' do it 'should be success' do
...@@ -33,7 +33,7 @@ describe Projects::Ci::LintsController do ...@@ -33,7 +33,7 @@ describe Projects::Ci::LintsController do
before do before do
project.add_guest(user) project.add_guest(user)
get :show, namespace_id: project.namespace, project_id: project get :show, params: { namespace_id: project.namespace, project_id: project }
end end
it 'should respond with 404' do it 'should respond with 404' do
...@@ -72,7 +72,7 @@ describe Projects::Ci::LintsController do ...@@ -72,7 +72,7 @@ describe Projects::Ci::LintsController do
WebMock.stub_request(:get, remote_file_path).to_return(body: remote_file_content) WebMock.stub_request(:get, remote_file_path).to_return(body: remote_file_content)
project.add_developer(user) 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 end
it 'should be success' do it 'should be success' do
...@@ -100,7 +100,7 @@ describe Projects::Ci::LintsController do ...@@ -100,7 +100,7 @@ describe Projects::Ci::LintsController do
before do before do
project.add_developer(user) 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 end
it 'should assign errors' do it 'should assign errors' do
...@@ -112,7 +112,7 @@ describe Projects::Ci::LintsController do ...@@ -112,7 +112,7 @@ describe Projects::Ci::LintsController do
before do before do
project.add_guest(user) 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 end
it 'should respond with 404' do it 'should respond with 404' do
......
...@@ -81,7 +81,7 @@ describe Projects::Clusters::ApplicationsController do ...@@ -81,7 +81,7 @@ describe Projects::Clusters::ApplicationsController do
end end
def go 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 end
end end
...@@ -18,7 +18,7 @@ describe Projects::ClustersController do ...@@ -18,7 +18,7 @@ describe Projects::ClustersController do
describe 'GET index' do describe 'GET index' do
def go(params = {}) 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 end
describe 'functionality' do describe 'functionality' do
...@@ -80,7 +80,7 @@ describe Projects::ClustersController do ...@@ -80,7 +80,7 @@ describe Projects::ClustersController do
describe 'GET new' do describe 'GET new' do
def go def go
get :new, namespace_id: project.namespace, project_id: project get :new, params: { namespace_id: project.namespace, project_id: project }
end end
describe 'functionality for new cluster' do describe 'functionality for new cluster' do
...@@ -174,7 +174,7 @@ describe Projects::ClustersController do ...@@ -174,7 +174,7 @@ describe Projects::ClustersController do
end end
def go 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 end
describe 'functionality' do describe 'functionality' do
...@@ -261,7 +261,7 @@ describe Projects::ClustersController do ...@@ -261,7 +261,7 @@ describe Projects::ClustersController do
end end
def go 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 end
describe 'functionality' do describe 'functionality' do
...@@ -331,9 +331,11 @@ describe Projects::ClustersController do ...@@ -331,9 +331,11 @@ describe Projects::ClustersController do
def go def go
get :cluster_status, get :cluster_status,
namespace_id: project.namespace.to_param, params: {
project_id: project.to_param, namespace_id: project.namespace.to_param,
id: cluster, project_id: project.to_param,
id: cluster
},
format: :json format: :json
end end
...@@ -369,9 +371,11 @@ describe Projects::ClustersController do ...@@ -369,9 +371,11 @@ describe Projects::ClustersController do
def go def go
get :show, get :show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: cluster project_id: project,
id: cluster
}
end end
describe 'functionality' do describe 'functionality' do
...@@ -397,11 +401,11 @@ describe Projects::ClustersController do ...@@ -397,11 +401,11 @@ describe Projects::ClustersController do
describe 'PUT update' do describe 'PUT update' do
def go(format: :html) def go(format: :html)
put :update, params.merge(namespace_id: project.namespace.to_param, put :update, params: params.merge(namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project.to_param,
id: cluster, id: cluster,
format: format format: format
) )
end end
before do before do
...@@ -500,9 +504,11 @@ describe Projects::ClustersController do ...@@ -500,9 +504,11 @@ describe Projects::ClustersController do
def go def go
delete :destroy, delete :destroy,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: cluster project_id: project,
id: cluster
}
end end
describe 'functionality' do describe 'functionality' do
......
...@@ -21,7 +21,7 @@ describe Projects::CommitController do ...@@ -21,7 +21,7 @@ describe Projects::CommitController do
project_id: project project_id: project
} }
get :show, params.merge(extra_params) get :show, params: params.merge(extra_params)
end end
context 'with valid id' do context 'with valid id' do
...@@ -102,9 +102,11 @@ describe Projects::CommitController do ...@@ -102,9 +102,11 @@ describe Projects::CommitController do
it 'renders it' do it 'renders it' do
get(:show, get(:show,
namespace_id: fork_project.namespace, params: {
project_id: fork_project, namespace_id: fork_project.namespace,
id: commit.id) project_id: fork_project,
id: commit.id
})
expect(response).to be_success expect(response).to be_success
end end
...@@ -132,9 +134,11 @@ describe Projects::CommitController do ...@@ -132,9 +134,11 @@ describe Projects::CommitController do
commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e') commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e')
get(:branches, get(:branches,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: commit.id) project_id: project,
id: commit.id
})
expect(assigns(:branches)).to include('master', 'feature_conflict') expect(assigns(:branches)).to include('master', 'feature_conflict')
expect(assigns(:branches_limit_exceeded)).to be_falsey expect(assigns(:branches_limit_exceeded)).to be_falsey
...@@ -148,9 +152,11 @@ describe Projects::CommitController do ...@@ -148,9 +152,11 @@ describe Projects::CommitController do
allow_any_instance_of(Repository).to receive(:tag_count).and_return(1001) allow_any_instance_of(Repository).to receive(:tag_count).and_return(1001)
get(:branches, get(:branches,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: commit.id) project_id: project,
id: commit.id
})
expect(assigns(:branches)).to eq([]) expect(assigns(:branches)).to eq([])
expect(assigns(:branches_limit_exceeded)).to be_truthy expect(assigns(:branches_limit_exceeded)).to be_truthy
...@@ -163,9 +169,11 @@ describe Projects::CommitController do ...@@ -163,9 +169,11 @@ describe Projects::CommitController do
context 'when target branch is not provided' do context 'when target branch is not provided' do
it 'renders the 404 page' do it 'renders the 404 page' do
post(:revert, post(:revert,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: commit.id) project_id: project,
id: commit.id
})
expect(response).not_to be_success expect(response).not_to be_success
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
...@@ -175,10 +183,12 @@ describe Projects::CommitController do ...@@ -175,10 +183,12 @@ describe Projects::CommitController do
context 'when the revert was successful' do context 'when the revert was successful' do
it 'redirects to the commits page' do it 'redirects to the commits page' do
post(:revert, post(:revert,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
start_branch: 'master', project_id: project,
id: commit.id) start_branch: 'master',
id: commit.id
})
expect(response).to redirect_to project_commits_path(project, 'master') expect(response).to redirect_to project_commits_path(project, 'master')
expect(flash[:notice]).to eq('The commit has been successfully reverted.') expect(flash[:notice]).to eq('The commit has been successfully reverted.')
...@@ -188,19 +198,23 @@ describe Projects::CommitController do ...@@ -188,19 +198,23 @@ describe Projects::CommitController do
context 'when the revert failed' do context 'when the revert failed' do
before do before do
post(:revert, post(:revert,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
start_branch: 'master', project_id: project,
id: commit.id) start_branch: 'master',
id: commit.id
})
end end
it 'redirects to the commit page' do it 'redirects to the commit page' do
# Reverting a commit that has been already reverted. # Reverting a commit that has been already reverted.
post(:revert, post(:revert,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
start_branch: 'master', project_id: project,
id: commit.id) start_branch: 'master',
id: commit.id
})
expect(response).to redirect_to project_commit_path(project, 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.') expect(flash[:alert]).to match('Sorry, we cannot revert this commit automatically.')
...@@ -212,9 +226,11 @@ describe Projects::CommitController do ...@@ -212,9 +226,11 @@ describe Projects::CommitController do
context 'when target branch is not provided' do context 'when target branch is not provided' do
it 'renders the 404 page' do it 'renders the 404 page' do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: master_pickable_commit.id) project_id: project,
id: master_pickable_commit.id
})
expect(response).not_to be_success expect(response).not_to be_success
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
...@@ -224,10 +240,12 @@ describe Projects::CommitController do ...@@ -224,10 +240,12 @@ describe Projects::CommitController do
context 'when the cherry-pick was successful' do context 'when the cherry-pick was successful' do
it 'redirects to the commits page' do it 'redirects to the commits page' do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
start_branch: 'master', project_id: project,
id: master_pickable_commit.id) start_branch: 'master',
id: master_pickable_commit.id
})
expect(response).to redirect_to project_commits_path(project, 'master') expect(response).to redirect_to project_commits_path(project, 'master')
expect(flash[:notice]).to eq('The commit has been successfully cherry-picked into master.') expect(flash[:notice]).to eq('The commit has been successfully cherry-picked into master.')
...@@ -237,19 +255,23 @@ describe Projects::CommitController do ...@@ -237,19 +255,23 @@ describe Projects::CommitController do
context 'when the cherry_pick failed' do context 'when the cherry_pick failed' do
before do before do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
start_branch: 'master', project_id: project,
id: master_pickable_commit.id) start_branch: 'master',
id: master_pickable_commit.id
})
end end
it 'redirects to the commit page' do it 'redirects to the commit page' do
# Cherry-picking a commit that has been already cherry-picked. # Cherry-picking a commit that has been already cherry-picked.
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
start_branch: 'master', project_id: project,
id: master_pickable_commit.id) start_branch: 'master',
id: master_pickable_commit.id
})
expect(response).to redirect_to project_commit_path(project, 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.') expect(flash[:alert]).to match('Sorry, we cannot cherry-pick this commit automatically.')
...@@ -264,7 +286,7 @@ describe Projects::CommitController do ...@@ -264,7 +286,7 @@ describe Projects::CommitController do
project_id: project project_id: project
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params: params.merge(extra_params)
end end
let(:existing_path) { '.gitmodules' } let(:existing_path) { '.gitmodules' }
...@@ -332,7 +354,7 @@ describe Projects::CommitController do ...@@ -332,7 +354,7 @@ describe Projects::CommitController do
project_id: project project_id: project
} }
get :pipelines, params.merge(extra_params) get :pipelines, params: params.merge(extra_params)
end end
context 'when the commit exists' do context 'when the commit exists' do
......
...@@ -17,8 +17,10 @@ describe Projects::CommitsController do ...@@ -17,8 +17,10 @@ describe Projects::CommitsController do
context "no ref is provided" do context "no ref is provided" do
it 'should redirect to the default branch of the project' do it 'should redirect to the default branch of the project' do
get(:commits_root, get(:commits_root,
namespace_id: project.namespace, params: {
project_id: project) namespace_id: project.namespace,
project_id: project
})
expect(response).to redirect_to project_commits_path(project) expect(response).to redirect_to project_commits_path(project)
end end
...@@ -31,9 +33,11 @@ describe Projects::CommitsController do ...@@ -31,9 +33,11 @@ describe Projects::CommitsController do
context 'with file path' do context 'with file path' do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id) project_id: project,
id: id
})
end end
context "valid branch, valid file" do context "valid branch, valid file" do
...@@ -65,9 +69,11 @@ describe Projects::CommitsController do ...@@ -65,9 +69,11 @@ describe Projects::CommitsController do
context "when the ref does not exist with the suffix" do context "when the ref does not exist with the suffix" do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: "master.atom") project_id: project,
id: "master.atom"
})
end end
it "renders as atom" do it "renders as atom" do
...@@ -88,9 +94,11 @@ describe Projects::CommitsController do ...@@ -88,9 +94,11 @@ describe Projects::CommitsController do
allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit) allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit)
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: "master.atom") project_id: project,
id: "master.atom"
})
end end
it "renders as HTML" do it "renders as HTML" do
...@@ -106,9 +114,11 @@ describe Projects::CommitsController do ...@@ -106,9 +114,11 @@ describe Projects::CommitsController do
before do before do
get(:signatures, get(:signatures,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id, project_id: project,
id: id
},
format: :json) format: :json)
end end
......
...@@ -13,7 +13,7 @@ describe Projects::CompareController do ...@@ -13,7 +13,7 @@ describe Projects::CompareController do
render_views render_views
before do before do
get :index, namespace_id: project.namespace, project_id: project get :index, params: { namespace_id: project.namespace, project_id: project }
end end
it 'returns successfully' do it 'returns successfully' do
...@@ -24,7 +24,7 @@ describe Projects::CompareController do ...@@ -24,7 +24,7 @@ describe Projects::CompareController do
describe 'GET show' do describe 'GET show' do
render_views render_views
subject(:show_request) { get :show, request_params } subject(:show_request) { get :show, params: request_params }
let(:request_params) do let(:request_params) do
{ {
...@@ -130,7 +130,7 @@ describe Projects::CompareController do ...@@ -130,7 +130,7 @@ describe Projects::CompareController do
project_id: project project_id: project
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params: params.merge(extra_params)
end end
let(:existing_path) { 'files/ruby/feature.rb' } let(:existing_path) { 'files/ruby/feature.rb' }
...@@ -201,7 +201,7 @@ describe Projects::CompareController do ...@@ -201,7 +201,7 @@ describe Projects::CompareController do
end end
describe 'POST create' do describe 'POST create' do
subject(:create_request) { post :create, request_params } subject(:create_request) { post :create, params: request_params }
let(:request_params) do let(:request_params) do
{ {
...@@ -260,7 +260,7 @@ describe Projects::CompareController do ...@@ -260,7 +260,7 @@ describe Projects::CompareController do
end end
describe 'GET signatures' do describe 'GET signatures' do
subject(:signatures_request) { get :signatures, request_params } subject(:signatures_request) { get :signatures, params: request_params }
let(:request_params) do let(:request_params) do
{ {
......
...@@ -13,8 +13,10 @@ describe Projects::CycleAnalyticsController do ...@@ -13,8 +13,10 @@ describe Projects::CycleAnalyticsController do
context 'with no data' do context 'with no data' do
it 'is true' do it 'is true' do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project) namespace_id: project.namespace,
project_id: project
})
expect(response).to be_success expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(true) expect(assigns(:cycle_analytics_no_data)).to eq(true)
...@@ -32,8 +34,10 @@ describe Projects::CycleAnalyticsController do ...@@ -32,8 +34,10 @@ describe Projects::CycleAnalyticsController do
it 'is false' do it 'is false' do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project) namespace_id: project.namespace,
project_id: project
})
expect(response).to be_success expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(false) expect(assigns(:cycle_analytics_no_data)).to eq(false)
......
...@@ -17,7 +17,7 @@ describe Projects::DeployKeysController do ...@@ -17,7 +17,7 @@ describe Projects::DeployKeysController do
context 'when html requested' do context 'when html requested' do
it 'redirects to blob' 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')) expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
end end
...@@ -48,7 +48,7 @@ describe Projects::DeployKeysController do ...@@ -48,7 +48,7 @@ describe Projects::DeployKeysController do
end end
it 'returns json in a correct format' do 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) json = JSON.parse(response.body)
...@@ -74,7 +74,7 @@ describe Projects::DeployKeysController do ...@@ -74,7 +74,7 @@ describe Projects::DeployKeysController do
it 'redirects to login' do it 'redirects to login' do
expect 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 } end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(302) expect(response).to have_http_status(302)
...@@ -89,7 +89,7 @@ describe Projects::DeployKeysController do ...@@ -89,7 +89,7 @@ describe Projects::DeployKeysController do
it 'returns 404' do it 'returns 404' do
expect 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 } end.not_to change { DeployKeysProject.count }
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
...@@ -103,7 +103,7 @@ describe Projects::DeployKeysController do ...@@ -103,7 +103,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do it 'returns 302' do
expect 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) end.to change { DeployKeysProject.count }.by(1)
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(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 ...@@ -112,7 +112,7 @@ describe Projects::DeployKeysController do
end end
it 'returns 404' do 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) expect(response).to have_http_status(404)
end end
...@@ -125,7 +125,7 @@ describe Projects::DeployKeysController do ...@@ -125,7 +125,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do it 'returns 302' do
expect 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) end.to change { DeployKeysProject.count }.by(1)
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(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 ...@@ -145,7 +145,7 @@ describe Projects::DeployKeysController do
end end
it 'redirects to login' do 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 have_http_status(302)
expect(response).to redirect_to(new_user_session_path) expect(response).to redirect_to(new_user_session_path)
...@@ -159,7 +159,7 @@ describe Projects::DeployKeysController do ...@@ -159,7 +159,7 @@ describe Projects::DeployKeysController do
end end
it 'returns 404' do 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(response).to have_http_status(404)
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key) expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
...@@ -168,7 +168,7 @@ describe Projects::DeployKeysController do ...@@ -168,7 +168,7 @@ describe Projects::DeployKeysController do
context 'with user with permission' do context 'with user with permission' do
it 'returns 302' 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 have_http_status(302)
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings')) expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
...@@ -177,7 +177,7 @@ describe Projects::DeployKeysController do ...@@ -177,7 +177,7 @@ describe Projects::DeployKeysController do
end end
it 'returns 404' do 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) expect(response).to have_http_status(404)
end end
...@@ -190,7 +190,7 @@ describe Projects::DeployKeysController do ...@@ -190,7 +190,7 @@ describe Projects::DeployKeysController do
it 'returns 302' do it 'returns 302' do
expect 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) end.to change { DeployKey.count }.by(-1)
expect(response).to have_http_status(302) expect(response).to have_http_status(302)
......
...@@ -19,7 +19,7 @@ describe Projects::DeploymentsController do ...@@ -19,7 +19,7 @@ describe Projects::DeploymentsController do
create(:deployment, :success, environment: environment, created_at: 7.hours.ago) create(:deployment, :success, environment: environment, created_at: 7.hours.ago)
create(:deployment, :success, environment: environment) 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 expect(response).to be_ok
...@@ -29,7 +29,7 @@ describe Projects::DeploymentsController do ...@@ -29,7 +29,7 @@ describe Projects::DeploymentsController do
it 'returns a list with deployments information' do it 'returns a list with deployments information' do
create(:deployment, :success, environment: environment) create(:deployment, :success, environment: environment)
get :index, deployment_params get :index, params: deployment_params
expect(response).to be_ok expect(response).to be_ok
expect(response).to match_response_schema('deployments') expect(response).to match_response_schema('deployments')
...@@ -49,7 +49,7 @@ describe Projects::DeploymentsController do ...@@ -49,7 +49,7 @@ describe Projects::DeploymentsController do
end end
it 'responds with not found' do 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 expect(response).to be_not_found
end end
...@@ -66,7 +66,7 @@ describe Projects::DeploymentsController do ...@@ -66,7 +66,7 @@ describe Projects::DeploymentsController do
end end
it 'returns a empty response 204 resposne' do 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).to have_gitlab_http_status(204)
expect(response.body).to eq('') expect(response.body).to eq('')
end end
...@@ -86,7 +86,7 @@ describe Projects::DeploymentsController do ...@@ -86,7 +86,7 @@ describe Projects::DeploymentsController do
end end
it 'returns a metrics JSON document' do 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(response).to be_ok
expect(json_response['success']).to be(true) expect(json_response['success']).to be(true)
...@@ -101,7 +101,7 @@ describe Projects::DeploymentsController do ...@@ -101,7 +101,7 @@ describe Projects::DeploymentsController do
end end
it 'responds with not found' do 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 expect(response).to be_not_found
end end
...@@ -122,7 +122,7 @@ describe Projects::DeploymentsController do ...@@ -122,7 +122,7 @@ describe Projects::DeploymentsController do
end end
it 'responds with not found' do 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 expect(response).to be_not_found
end end
...@@ -141,7 +141,7 @@ describe Projects::DeploymentsController do ...@@ -141,7 +141,7 @@ describe Projects::DeploymentsController do
end end
it 'returns a empty response 204 response' do 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).to have_gitlab_http_status(204)
expect(response.body).to eq('') expect(response.body).to eq('')
end end
...@@ -161,7 +161,7 @@ describe Projects::DeploymentsController do ...@@ -161,7 +161,7 @@ describe Projects::DeploymentsController do
end end
it 'returns a metrics JSON document' do 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(response).to be_ok
expect(json_response['success']).to be(true) expect(json_response['success']).to be(true)
......
...@@ -23,7 +23,7 @@ describe Projects::DiscussionsController do ...@@ -23,7 +23,7 @@ describe Projects::DiscussionsController do
context 'when user is not authorized to read the MR' do context 'when user is not authorized to read the MR' do
it 'returns 404' 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -35,7 +35,7 @@ describe Projects::DiscussionsController do ...@@ -35,7 +35,7 @@ describe Projects::DiscussionsController do
end end
it 'returns status 200' do 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -43,7 +43,7 @@ describe Projects::DiscussionsController do ...@@ -43,7 +43,7 @@ describe Projects::DiscussionsController do
it 'returns status 404 if MR does not exists' do it 'returns status 404 if MR does not exists' do
merge_request.destroy! 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -56,7 +56,7 @@ describe Projects::DiscussionsController do ...@@ -56,7 +56,7 @@ describe Projects::DiscussionsController do
end end
it 'returns status 200' do 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -70,7 +70,7 @@ describe Projects::DiscussionsController do ...@@ -70,7 +70,7 @@ describe Projects::DiscussionsController do
context "when the user is not authorized to resolve the discussion" do context "when the user is not authorized to resolve the discussion" do
it "returns status 404" do it "returns status 404" do
post :resolve, request_params post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -87,7 +87,7 @@ describe Projects::DiscussionsController do ...@@ -87,7 +87,7 @@ describe Projects::DiscussionsController do
end end
it "returns status 404" do it "returns status 404" do
post :resolve, request_params post :resolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -95,7 +95,7 @@ describe Projects::DiscussionsController do ...@@ -95,7 +95,7 @@ describe Projects::DiscussionsController do
context "when the discussion is resolvable" do context "when the discussion is resolvable" do
it "resolves the discussion" 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?).to be true
expect(note.reload.discussion.resolved_by).to eq(user) expect(note.reload.discussion.resolved_by).to eq(user)
...@@ -104,17 +104,17 @@ describe Projects::DiscussionsController do ...@@ -104,17 +104,17 @@ describe Projects::DiscussionsController do
it "sends notifications if all discussions are resolved" do it "sends notifications if all discussions are resolved" do
expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request) expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request)
post :resolve, request_params post :resolve, params: request_params
end end
it "returns the name of the resolving user" do 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) expect(JSON.parse(response.body)['resolved_by']['name']).to eq(user.name)
end end
it "returns status 200" do it "returns status 200" do
post :resolve, request_params post :resolve, params: request_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
...@@ -123,7 +123,7 @@ describe Projects::DiscussionsController do ...@@ -123,7 +123,7 @@ describe Projects::DiscussionsController do
expect_any_instance_of(DiscussionSerializer).to receive(:represent) expect_any_instance_of(DiscussionSerializer).to receive(:represent)
.with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true }) .with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true })
post :resolve, request_params post :resolve, params: request_params
end end
context 'diff discussion' do context 'diff discussion' do
...@@ -131,7 +131,7 @@ describe Projects::DiscussionsController do ...@@ -131,7 +131,7 @@ describe Projects::DiscussionsController do
let(:discussion) { note.discussion } let(:discussion) { note.discussion }
it "returns truncated diff lines" do 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 expect(JSON.parse(response.body)['truncated_diff_lines']).to be_present
end end
...@@ -149,7 +149,7 @@ describe Projects::DiscussionsController do ...@@ -149,7 +149,7 @@ describe Projects::DiscussionsController do
context "when the user is not authorized to resolve the discussion" do context "when the user is not authorized to resolve the discussion" do
it "returns status 404" do it "returns status 404" do
delete :unresolve, request_params delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -166,7 +166,7 @@ describe Projects::DiscussionsController do ...@@ -166,7 +166,7 @@ describe Projects::DiscussionsController do
end end
it "returns status 404" do it "returns status 404" do
delete :unresolve, request_params delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -174,13 +174,13 @@ describe Projects::DiscussionsController do ...@@ -174,13 +174,13 @@ describe Projects::DiscussionsController do
context "when the discussion is resolvable" do context "when the discussion is resolvable" do
it "unresolves the discussion" do it "unresolves the discussion" do
delete :unresolve, request_params delete :unresolve, params: request_params
expect(note.reload.discussion.resolved?).to be false expect(note.reload.discussion.resolved?).to be false
end end
it "returns status 200" do it "returns status 200" do
delete :unresolve, request_params delete :unresolve, params: request_params
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
...@@ -194,7 +194,7 @@ describe Projects::DiscussionsController do ...@@ -194,7 +194,7 @@ describe Projects::DiscussionsController do
expect_any_instance_of(DiscussionSerializer).to receive(:represent) expect_any_instance_of(DiscussionSerializer).to receive(:represent)
.with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true }) .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 end
end end
......
...@@ -17,7 +17,7 @@ describe Projects::EnvironmentsController do ...@@ -17,7 +17,7 @@ describe Projects::EnvironmentsController do
describe 'GET index' do describe 'GET index' do
context 'when a request for the HTML is made' do context 'when a request for the HTML is made' do
it 'responds with status code 200' 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) expect(response).to have_gitlab_http_status(:ok)
end end
...@@ -26,7 +26,7 @@ describe Projects::EnvironmentsController do ...@@ -26,7 +26,7 @@ describe Projects::EnvironmentsController do
expect_any_instance_of(Gitlab::EtagCaching::Store) expect_any_instance_of(Gitlab::EtagCaching::Store)
.to receive(:touch).with(project_environments_path(project, format: :json)) .to receive(:touch).with(project_environments_path(project, format: :json))
get :index, environment_params get :index, params: environment_params
end end
end end
...@@ -49,7 +49,7 @@ describe Projects::EnvironmentsController do ...@@ -49,7 +49,7 @@ describe Projects::EnvironmentsController do
context 'when requesting available environments scope' do context 'when requesting available environments scope' do
before do before do
get :index, environment_params(format: :json, scope: :available) get :index, params: environment_params(format: :json, scope: :available)
end end
it 'responds with a payload describing available environments' do it 'responds with a payload describing available environments' do
...@@ -73,7 +73,7 @@ describe Projects::EnvironmentsController do ...@@ -73,7 +73,7 @@ describe Projects::EnvironmentsController do
context 'when requesting stopped environments scope' do context 'when requesting stopped environments scope' do
before do before do
get :index, environment_params(format: :json, scope: :stopped) get :index, params: environment_params(format: :json, scope: :stopped)
end end
it 'responds with a payload describing stopped environments' do it 'responds with a payload describing stopped environments' do
...@@ -103,9 +103,11 @@ describe Projects::EnvironmentsController do ...@@ -103,9 +103,11 @@ describe Projects::EnvironmentsController do
context 'when using default format' do context 'when using default format' do
it 'responds with HTML' do it 'responds with HTML' do
get :folder, namespace_id: project.namespace, get :folder, params: {
project_id: project, namespace_id: project.namespace,
id: 'staging-1.0' project_id: project,
id: 'staging-1.0'
}
expect(response).to be_ok expect(response).to be_ok
expect(response).to render_template 'folder' expect(response).to render_template 'folder'
...@@ -114,9 +116,11 @@ describe Projects::EnvironmentsController do ...@@ -114,9 +116,11 @@ describe Projects::EnvironmentsController do
context 'when using JSON format' do context 'when using JSON format' do
it 'sorts the subfolders lexicographically' do it 'sorts the subfolders lexicographically' do
get :folder, namespace_id: project.namespace, get :folder, params: {
project_id: project, namespace_id: project.namespace,
id: 'staging-1.0', project_id: project,
id: 'staging-1.0'
},
format: :json format: :json
expect(response).to be_ok expect(response).to be_ok
...@@ -132,7 +136,7 @@ describe Projects::EnvironmentsController do ...@@ -132,7 +136,7 @@ describe Projects::EnvironmentsController do
describe 'GET show' do describe 'GET show' do
context 'with valid id' do context 'with valid id' do
it 'responds with a status code 200' do it 'responds with a status code 200' do
get :show, environment_params get :show, params: environment_params
expect(response).to be_ok expect(response).to be_ok
end end
...@@ -142,7 +146,7 @@ describe Projects::EnvironmentsController do ...@@ -142,7 +146,7 @@ describe Projects::EnvironmentsController do
it 'responds with a status code 404' do it 'responds with a status code 404' do
params = environment_params params = environment_params
params[:id] = 12345 params[:id] = 12345
get :show, params get :show, params: params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(404)
end end
...@@ -151,7 +155,7 @@ describe Projects::EnvironmentsController do ...@@ -151,7 +155,7 @@ describe Projects::EnvironmentsController do
describe 'GET edit' do describe 'GET edit' do
it 'responds with a status code 200' do it 'responds with a status code 200' do
get :edit, environment_params get :edit, params: environment_params
expect(response).to be_ok expect(response).to be_ok
end end
...@@ -160,7 +164,7 @@ describe Projects::EnvironmentsController do ...@@ -160,7 +164,7 @@ describe Projects::EnvironmentsController do
describe 'PATCH #update' do describe 'PATCH #update' do
it 'responds with a 302' do it 'responds with a 302' do
patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' }) 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) expect(response).to have_gitlab_http_status(302)
end end
...@@ -171,7 +175,7 @@ describe Projects::EnvironmentsController do ...@@ -171,7 +175,7 @@ describe Projects::EnvironmentsController do
it 'returns 404' do it 'returns 404' do
allow_any_instance_of(Environment).to receive(:available?) { false } 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -184,7 +188,7 @@ describe Projects::EnvironmentsController do ...@@ -184,7 +188,7 @@ describe Projects::EnvironmentsController do
allow_any_instance_of(Environment) allow_any_instance_of(Environment)
.to receive_messages(available?: true, stop_with_action!: action) .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(response).to have_gitlab_http_status(200)
expect(json_response).to eq( expect(json_response).to eq(
...@@ -198,7 +202,7 @@ describe Projects::EnvironmentsController do ...@@ -198,7 +202,7 @@ describe Projects::EnvironmentsController do
allow_any_instance_of(Environment) allow_any_instance_of(Environment)
.to receive_messages(available?: true, stop_with_action!: nil) .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(response).to have_gitlab_http_status(200)
expect(json_response).to eq( expect(json_response).to eq(
...@@ -211,7 +215,7 @@ describe Projects::EnvironmentsController do ...@@ -211,7 +215,7 @@ describe Projects::EnvironmentsController do
describe 'GET #terminal' do describe 'GET #terminal' do
context 'with valid id' do context 'with valid id' do
it 'responds with a status code 200' 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) expect(response).to have_gitlab_http_status(200)
end end
...@@ -222,13 +226,13 @@ describe Projects::EnvironmentsController do ...@@ -222,13 +226,13 @@ describe Projects::EnvironmentsController do
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment) expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
.to receive(:terminals) .to receive(:terminals)
get :terminal, environment_params get :terminal, params: environment_params
end end
end end
context 'with invalid id' do context 'with invalid id' do
it 'responds with a status code 404' 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -254,7 +258,7 @@ describe Projects::EnvironmentsController do ...@@ -254,7 +258,7 @@ describe Projects::EnvironmentsController do
.with(:fake_terminal) .with(:fake_terminal)
.and_return(workhorse: :response) .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).to have_gitlab_http_status(200)
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE) expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
...@@ -264,7 +268,7 @@ describe Projects::EnvironmentsController do ...@@ -264,7 +268,7 @@ describe Projects::EnvironmentsController do
context 'and invalid id' do context 'and invalid id' do
it 'returns 404' 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -275,7 +279,7 @@ describe Projects::EnvironmentsController do ...@@ -275,7 +279,7 @@ describe Projects::EnvironmentsController do
it 'aborts with an exception' do it 'aborts with an exception' do
allow(Gitlab::Workhorse).to receive(:verify_api_request!).and_raise(JWT::DecodeError) 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 # controller tests don't set the response status correctly. It's enough
# to check that the action raised an exception # to check that the action raised an exception
end end
...@@ -288,13 +292,13 @@ describe Projects::EnvironmentsController do ...@@ -288,13 +292,13 @@ describe Projects::EnvironmentsController do
it 'redirects to environment if it exists' do it 'redirects to environment if it exists' do
environment = create(:environment, name: 'production', project: project) 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)) expect(response).to redirect_to(environment_metrics_path(environment))
end end
it 'redirects to empty page if no environment exists' do 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 be_ok
expect(response).to render_template 'empty' expect(response).to render_template 'empty'
...@@ -312,14 +316,14 @@ describe Projects::EnvironmentsController do ...@@ -312,14 +316,14 @@ describe Projects::EnvironmentsController do
end end
it 'returns a metrics page' do it 'returns a metrics page' do
get :metrics, environment_params get :metrics, params: environment_params
expect(response).to be_ok expect(response).to be_ok
end end
context 'when requesting metrics as JSON' do context 'when requesting metrics as JSON' do
it 'returns a metrics JSON document' 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(response).to have_gitlab_http_status(204)
expect(json_response).to eq({}) expect(json_response).to eq({})
...@@ -337,7 +341,7 @@ describe Projects::EnvironmentsController do ...@@ -337,7 +341,7 @@ describe Projects::EnvironmentsController do
end end
it 'returns a metrics JSON document' do 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(response).to be_ok
expect(json_response['success']).to be(true) expect(json_response['success']).to be(true)
...@@ -359,7 +363,7 @@ describe Projects::EnvironmentsController do ...@@ -359,7 +363,7 @@ describe Projects::EnvironmentsController do
context 'when requesting metrics as JSON' do context 'when requesting metrics as JSON' do
it 'returns a metrics JSON document' 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(response).to have_gitlab_http_status(204)
expect(json_response).to eq({}) expect(json_response).to eq({})
...@@ -379,7 +383,7 @@ describe Projects::EnvironmentsController do ...@@ -379,7 +383,7 @@ describe Projects::EnvironmentsController do
end end
it 'returns a metrics JSON document' 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 be_ok expect(response).to be_ok
expect(json_response['success']).to be(true) expect(json_response['success']).to be(true)
......
...@@ -17,9 +17,11 @@ describe Projects::FindFileController do ...@@ -17,9 +17,11 @@ describe Projects::FindFileController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id) project_id: project,
id: id
})
end end
context "valid branch" do context "valid branch" do
...@@ -36,9 +38,11 @@ describe Projects::FindFileController do ...@@ -36,9 +38,11 @@ describe Projects::FindFileController do
describe "GET #list" do describe "GET #list" do
def go(format: 'json') def go(format: 'json')
get :list, get :list,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
id: id, project_id: project,
id: id
},
format: format format: format
end end
......
...@@ -13,8 +13,10 @@ describe Projects::ForksController do ...@@ -13,8 +13,10 @@ describe Projects::ForksController do
describe 'GET index' do describe 'GET index' do
def get_forks def get_forks
get :index, get :index,
namespace_id: project.namespace, params: {
project_id: project namespace_id: project.namespace,
project_id: project
}
end end
context 'when fork is public' do context 'when fork is public' do
...@@ -83,8 +85,10 @@ describe Projects::ForksController do ...@@ -83,8 +85,10 @@ describe Projects::ForksController do
describe 'GET new' do describe 'GET new' do
def get_new def get_new
get :new, get :new,
namespace_id: project.namespace, params: {
project_id: project namespace_id: project.namespace,
project_id: project
}
end end
context 'when user is signed in' do context 'when user is signed in' do
...@@ -111,9 +115,11 @@ describe Projects::ForksController do ...@@ -111,9 +115,11 @@ describe Projects::ForksController do
describe 'POST create' do describe 'POST create' do
def post_create def post_create
post :create, post :create,
namespace_id: project.namespace, params: {
project_id: project, namespace_id: project.namespace,
namespace_key: user.namespace.id project_id: project,
namespace_key: user.namespace.id
}
end end
context 'when user is signed in' do context 'when user is signed in' do
......
...@@ -11,7 +11,7 @@ describe Projects::GraphsController do ...@@ -11,7 +11,7 @@ describe Projects::GraphsController do
describe 'GET languages' do describe 'GET languages' do
it "redirects_to action charts" 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 expect(response).to redirect_to action: :charts
end end
...@@ -19,7 +19,7 @@ describe Projects::GraphsController do ...@@ -19,7 +19,7 @@ describe Projects::GraphsController do
describe 'GET commits' do describe 'GET commits' do
it "redirects_to action charts" 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 expect(response).to redirect_to action: :charts
end end
......
...@@ -14,10 +14,12 @@ describe Projects::GroupLinksController do ...@@ -14,10 +14,12 @@ describe Projects::GroupLinksController do
describe '#create' do describe '#create' do
shared_context 'link project to group' do shared_context 'link project to group' do
before do before do
post(:create, namespace_id: project.namespace, post(:create, params: {
project_id: project, namespace_id: project.namespace,
link_group_id: group.id, project_id: project,
link_group_access: ProjectGroupLink.default_access) link_group_id: group.id,
link_group_access: ProjectGroupLink.default_access
})
end end
end end
...@@ -65,10 +67,12 @@ describe Projects::GroupLinksController do ...@@ -65,10 +67,12 @@ describe Projects::GroupLinksController do
context 'when project group id equal link group id' do context 'when project group id equal link group id' do
before do before do
post(:create, namespace_id: project.namespace, post(:create, params: {
project_id: project, namespace_id: project.namespace,
link_group_id: group2.id, project_id: project,
link_group_access: ProjectGroupLink.default_access) link_group_id: group2.id,
link_group_access: ProjectGroupLink.default_access
})
end end
it 'does not share project with selected group' do it 'does not share project with selected group' do
...@@ -84,9 +88,11 @@ describe Projects::GroupLinksController do ...@@ -84,9 +88,11 @@ describe Projects::GroupLinksController do
context 'when link group id is not present' do context 'when link group id is not present' do
before do before do
post(:create, namespace_id: project.namespace, post(:create, params: {
project_id: project, namespace_id: project.namespace,
link_group_access: ProjectGroupLink.default_access) project_id: project,
link_group_access: ProjectGroupLink.default_access
})
end end
it 'redirects to project group links page' do it 'redirects to project group links page' do
......
...@@ -11,7 +11,7 @@ describe Projects::HooksController do ...@@ -11,7 +11,7 @@ describe Projects::HooksController do
describe '#index' do describe '#index' do
it 'redirects to settings/integrations page' 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( expect(response).to redirect_to(
project_settings_integrations_path(project) project_settings_integrations_path(project)
...@@ -38,7 +38,7 @@ describe Projects::HooksController do ...@@ -38,7 +38,7 @@ describe Projects::HooksController do
wiki_page_events: true 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(response).to have_http_status(302)
expect(ProjectHook.all.size).to eq(1) expect(ProjectHook.all.size).to eq(1)
......
...@@ -12,13 +12,13 @@ describe Projects::ImportsController do ...@@ -12,13 +12,13 @@ describe Projects::ImportsController do
describe 'GET #show' do describe 'GET #show' do
context 'when repository does not exists' do context 'when repository does not exists' do
it 'renders template' 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 expect(response).to render_template :show
end end
it 'sets flash.now if params is present' do 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' expect(flash.now[:notice]).to eq 'Started'
end end
...@@ -34,13 +34,13 @@ describe Projects::ImportsController do ...@@ -34,13 +34,13 @@ describe Projects::ImportsController do
end end
it 'renders template' 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 expect(response).to render_template :show
end end
it 'sets flash.now if params is present' do 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' expect(flash.now[:notice]).to eq 'In progress'
end end
...@@ -52,7 +52,7 @@ describe Projects::ImportsController do ...@@ -52,7 +52,7 @@ describe Projects::ImportsController do
end end
it 'redirects to new_namespace_project_import_path' do 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) expect(response).to redirect_to new_project_import_path(project)
end end
...@@ -67,7 +67,7 @@ describe Projects::ImportsController do ...@@ -67,7 +67,7 @@ describe Projects::ImportsController do
it 'redirects to namespace_project_path' do it 'redirects to namespace_project_path' do
allow_any_instance_of(Project).to receive(:forked?).and_return(true) 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(flash[:notice]).to eq 'The project was successfully forked.'
expect(response).to redirect_to project_path(project) expect(response).to redirect_to project_path(project)
...@@ -76,7 +76,7 @@ describe Projects::ImportsController do ...@@ -76,7 +76,7 @@ describe Projects::ImportsController do
context 'when project is external' do context 'when project is external' do
it 'redirects to namespace_project_path' 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(flash[:notice]).to eq 'The project was successfully imported.'
expect(response).to redirect_to project_path(project) expect(response).to redirect_to project_path(project)
...@@ -92,7 +92,7 @@ describe Projects::ImportsController do ...@@ -92,7 +92,7 @@ describe Projects::ImportsController do
end end
it 'redirects to internal params[:to]' do 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(flash[:notice]).to eq params[:notice]
expect(response).to redirect_to params[:to] expect(response).to redirect_to params[:to]
...@@ -101,7 +101,7 @@ describe Projects::ImportsController do ...@@ -101,7 +101,7 @@ describe Projects::ImportsController do
it 'does not redirect to external params[:to]' do it 'does not redirect to external params[:to]' do
params[:to] = "//google.com" 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] expect(response).not_to redirect_to params[:to]
end end
end end
...@@ -113,7 +113,7 @@ describe Projects::ImportsController do ...@@ -113,7 +113,7 @@ describe Projects::ImportsController do
end end
it 'redirects to namespace_project_path' 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(response).to redirect_to project_path(project) expect(response).to redirect_to project_path(project)
end end
......
...@@ -96,7 +96,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -96,7 +96,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project project_id: project
} }
get :index, params.merge(extra_params) get :index, params: params.merge(extra_params)
end end
end end
...@@ -461,7 +461,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -461,7 +461,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project project_id: project
} }
get :show, params.merge(extra_params) get :show, params: params.merge(extra_params)
end end
end end
...@@ -552,9 +552,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -552,9 +552,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def get_trace def get_trace
get :trace, namespace_id: project.namespace, get :trace, params: {
project_id: project, namespace_id: project.namespace,
id: job.id, project_id: project,
id: job.id
},
format: :json format: :json
end end
end end
...@@ -564,9 +566,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -564,9 +566,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
let(:status) { job.detailed_status(double('user')) } let(:status) { job.detailed_status(double('user')) }
before do before do
get :status, namespace_id: project.namespace, get :status, params: {
project_id: project, namespace_id: project.namespace,
id: job.id, project_id: project,
id: job.id
},
format: :json format: :json
end end
...@@ -605,9 +609,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -605,9 +609,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def post_retry def post_retry
post :retry, namespace_id: project.namespace, post :retry, params: {
project_id: project, namespace_id: project.namespace,
id: job.id project_id: project,
id: job.id
}
end end
end end
...@@ -645,9 +651,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -645,9 +651,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def post_play def post_play
post :play, namespace_id: project.namespace, post :play, params: {
project_id: project, namespace_id: project.namespace,
id: job.id project_id: project,
id: job.id
}
end end
end end
...@@ -714,9 +722,9 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -714,9 +722,9 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def post_cancel(additional_params = {}) def post_cancel(additional_params = {})
post :cancel, { namespace_id: project.namespace, post :cancel, params: { namespace_id: project.namespace,
project_id: project, project_id: project,
id: job.id }.merge(additional_params) id: job.id }.merge(additional_params)
end end
end end
...@@ -754,9 +762,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -754,9 +762,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def post_unschedule def post_unschedule
post :unschedule, namespace_id: project.namespace, post :unschedule, params: {
project_id: project, namespace_id: project.namespace,
id: job.id project_id: project,
id: job.id
}
end end
end end
...@@ -797,8 +807,10 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -797,8 +807,10 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def post_cancel_all def post_cancel_all
post :cancel_all, namespace_id: project.namespace, post :cancel_all, params: {
project_id: project namespace_id: project.namespace,
project_id: project
}
end end
end end
...@@ -860,17 +872,21 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -860,17 +872,21 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
def post_erase def post_erase
post :erase, namespace_id: project.namespace, post :erase, params: {
project_id: project, namespace_id: project.namespace,
id: job.id project_id: project,
id: job.id
}
end end
end end
describe 'GET raw' do describe 'GET raw' do
subject do subject do
post :raw, namespace_id: project.namespace, post :raw, params: {
project_id: project, namespace_id: project.namespace,
id: job.id project_id: project,
id: job.id
}
end end
context "when job has a trace artifact" do context "when job has a trace artifact" do
...@@ -1020,7 +1036,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -1020,7 +1036,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project project_id: project
} }
get :terminal, params.merge(extra_params) get :terminal, params: params.merge(extra_params)
end end
end end
...@@ -1074,7 +1090,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -1074,7 +1090,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
project_id: project project_id: project
} }
get :terminal_websocket_authorize, params.merge(extra_params) get :terminal_websocket_authorize, params: params.merge(extra_params)
end end
end end
end end
...@@ -67,7 +67,7 @@ describe Projects::LabelsController do ...@@ -67,7 +67,7 @@ describe Projects::LabelsController do
end end
def list_labels 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
end end
...@@ -76,7 +76,7 @@ describe Projects::LabelsController do ...@@ -76,7 +76,7 @@ describe Projects::LabelsController do
let(:personal_project) { create(:project, namespace: user.namespace) } let(:personal_project) { create(:project, namespace: user.namespace) }
it 'creates labels' do 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) expect(response).to have_gitlab_http_status(302)
end end
...@@ -84,7 +84,7 @@ describe Projects::LabelsController do ...@@ -84,7 +84,7 @@ describe Projects::LabelsController do
context 'project belonging to a group' do context 'project belonging to a group' do
it 'creates labels' 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) expect(response).to have_gitlab_http_status(302)
end end
...@@ -109,7 +109,7 @@ describe Projects::LabelsController do ...@@ -109,7 +109,7 @@ describe Projects::LabelsController do
end end
def toggle_subscription(label) 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
end end
...@@ -119,7 +119,7 @@ describe Projects::LabelsController do ...@@ -119,7 +119,7 @@ describe Projects::LabelsController do
context 'not group reporters' do context 'not group reporters' do
it 'denies access' 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) expect(response).to have_gitlab_http_status(404)
end end
...@@ -131,13 +131,13 @@ describe Projects::LabelsController do ...@@ -131,13 +131,13 @@ describe Projects::LabelsController do
end end
it 'gives access' do 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) expect(response).to redirect_to(namespace_project_labels_path)
end end
it 'promotes the label' do 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(Label.where(id: label_1.id)).to be_empty
expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil
...@@ -146,7 +146,7 @@ describe Projects::LabelsController do ...@@ -146,7 +146,7 @@ describe Projects::LabelsController do
it 'renders label name without parsing it as HTML' do it 'renders label name without parsing it as HTML' do
label_1.update!(name: 'CCC<img src=x onerror=alert(document.domain)>') label_1.update!(name: 'CCC<img src=x onerror=alert(document.domain)>')
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>.") 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 end
...@@ -159,7 +159,7 @@ describe Projects::LabelsController do ...@@ -159,7 +159,7 @@ describe Projects::LabelsController do
end end
it 'returns to label list' do 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) expect(response).to redirect_to(namespace_project_labels_path)
end end
end end
...@@ -176,7 +176,7 @@ describe Projects::LabelsController do ...@@ -176,7 +176,7 @@ describe Projects::LabelsController do
context 'non-show path' do context 'non-show path' do
context 'with exactly matching casing' do context 'with exactly matching casing' do
it 'does not redirect' 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) expect(response).not_to have_gitlab_http_status(301)
end end
...@@ -184,7 +184,7 @@ describe Projects::LabelsController do ...@@ -184,7 +184,7 @@ describe Projects::LabelsController do
context 'with different casing' do context 'with different casing' do
it 'redirects to the correct 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(response).to redirect_to(project_labels_path(project))
expect(controller).not_to set_flash[:notice] expect(controller).not_to set_flash[:notice]
...@@ -197,7 +197,7 @@ describe Projects::LabelsController do ...@@ -197,7 +197,7 @@ describe Projects::LabelsController do
let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') } let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') }
it 'redirects to the canonical path' do 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(response).to redirect_to(project_labels_path(project))
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project)) expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project))
...@@ -209,13 +209,13 @@ describe Projects::LabelsController do ...@@ -209,13 +209,13 @@ describe Projects::LabelsController do
context 'for a non-GET request' do context 'for a non-GET request' do
context 'when requesting the canonical path with different casing' do context 'when requesting the canonical path with different casing' do
it 'does not 404' 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) expect(response).not_to have_gitlab_http_status(404)
end end
it 'does not redirect to the correct casing' do 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) expect(response).not_to have_gitlab_http_status(301)
end end
...@@ -225,7 +225,7 @@ describe Projects::LabelsController do ...@@ -225,7 +225,7 @@ describe Projects::LabelsController do
let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') } let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') }
it 'returns not found' do 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) expect(response).to have_gitlab_http_status(404)
end end
......
...@@ -17,8 +17,10 @@ describe Projects::MattermostsController do ...@@ -17,8 +17,10 @@ describe Projects::MattermostsController do
it 'accepts the request' do it 'accepts the request' do
get(:new, get(:new,
namespace_id: project.namespace.to_param, params: {
project_id: project) namespace_id: project.namespace.to_param,
project_id: project
})
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
...@@ -29,9 +31,11 @@ describe Projects::MattermostsController do ...@@ -29,9 +31,11 @@ describe Projects::MattermostsController do
subject do subject do
post(:create, post(:create,
namespace_id: project.namespace.to_param, params: {
project_id: project, namespace_id: project.namespace.to_param,
mattermost: mattermost_params) project_id: project,
mattermost: mattermost_params
})
end end
context 'no request can be made to mattermost' do context 'no request can be made to mattermost' do
......
...@@ -21,9 +21,11 @@ describe Projects::MergeRequests::ConflictsController do ...@@ -21,9 +21,11 @@ describe Projects::MergeRequests::ConflictsController do
.and_raise(Gitlab::Git::Conflict::Parser::UnmergeableFile) .and_raise(Gitlab::Git::Conflict::Parser::UnmergeableFile)
get :show, get :show,
namespace_id: merge_request_with_conflicts.project.namespace.to_param, params: {
project_id: merge_request_with_conflicts.project, namespace_id: merge_request_with_conflicts.project.namespace.to_param,
id: merge_request_with_conflicts.iid, project_id: merge_request_with_conflicts.project,
id: merge_request_with_conflicts.iid
},
format: 'json' format: 'json'
end end
...@@ -39,9 +41,11 @@ describe Projects::MergeRequests::ConflictsController do ...@@ -39,9 +41,11 @@ describe Projects::MergeRequests::ConflictsController do
context 'with valid conflicts' do context 'with valid conflicts' do
before do before do
get :show, get :show,
namespace_id: merge_request_with_conflicts.project.namespace.to_param, params: {
project_id: merge_request_with_conflicts.project, namespace_id: merge_request_with_conflicts.project.namespace.to_param,
id: merge_request_with_conflicts.iid, project_id: merge_request_with_conflicts.project,
id: merge_request_with_conflicts.iid
},
format: 'json' format: 'json'
end end
...@@ -99,11 +103,13 @@ describe Projects::MergeRequests::ConflictsController do ...@@ -99,11 +103,13 @@ describe Projects::MergeRequests::ConflictsController do
describe 'GET conflict_for_path' do describe 'GET conflict_for_path' do
def conflict_for_path(path) def conflict_for_path(path)
get :conflict_for_path, get :conflict_for_path,
namespace_id: merge_request_with_conflicts.project.namespace.to_param, params: {
project_id: merge_request_with_conflicts.project, namespace_id: merge_request_with_conflicts.project.namespace.to_param,
id: merge_request_with_conflicts.iid, project_id: merge_request_with_conflicts.project,
old_path: path, id: merge_request_with_conflicts.iid,
new_path: path, old_path: path,
new_path: path
},
format: 'json' format: 'json'
end end
...@@ -160,12 +166,14 @@ describe Projects::MergeRequests::ConflictsController do ...@@ -160,12 +166,14 @@ describe Projects::MergeRequests::ConflictsController do
def resolve_conflicts(files) def resolve_conflicts(files)
post :resolve_conflicts, post :resolve_conflicts,
namespace_id: merge_request_with_conflicts.project.namespace.to_param, params: {
project_id: merge_request_with_conflicts.project, namespace_id: merge_request_with_conflicts.project.namespace.to_param,
id: merge_request_with_conflicts.iid, project_id: merge_request_with_conflicts.project,
format: 'json', id: merge_request_with_conflicts.iid,
files: files, files: files,
commit_message: 'Commit message' commit_message: 'Commit message'
},
format: 'json'
end end
context 'with valid params' do context 'with valid params' do
......
...@@ -20,7 +20,7 @@ describe Projects::MergeRequests::DiffsController do ...@@ -20,7 +20,7 @@ describe Projects::MergeRequests::DiffsController do
format: 'json' format: 'json'
} }
get :show, params.merge(extra_params) get :show, params: params.merge(extra_params)
end end
context 'with default params' do context 'with default params' do
...@@ -89,7 +89,7 @@ describe Projects::MergeRequests::DiffsController do ...@@ -89,7 +89,7 @@ describe Projects::MergeRequests::DiffsController do
format: 'json' format: 'json'
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params: params.merge(extra_params)
end end
let(:existing_path) { 'files/ruby/popen.rb' } let(:existing_path) { 'files/ruby/popen.rb' }
......
...@@ -147,7 +147,7 @@ describe Projects::MirrorsController do ...@@ -147,7 +147,7 @@ describe Projects::MirrorsController do
end end
def do_get(project, url = 'ssh://example.com') 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
end end
...@@ -155,6 +155,6 @@ describe Projects::MirrorsController do ...@@ -155,6 +155,6 @@ describe Projects::MirrorsController do
attrs = extra_attrs.merge(namespace_id: project.namespace.to_param, project_id: project.to_param) attrs = extra_attrs.merge(namespace_id: project.namespace.to_param, project_id: project.to_param)
attrs[:project] = options attrs[:project] = options
put :update, attrs put :update, params: attrs
end end
end end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment