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 }`
This commit is contained in:
parent
5d68c23792
commit
b44a2c801a
|
|
@ -8,7 +8,7 @@ require:
|
|||
- rubocop-rspec
|
||||
|
||||
AllCops:
|
||||
TargetRailsVersion: 4.2
|
||||
TargetRailsVersion: 5.0
|
||||
Exclude:
|
||||
- 'vendor/**/*'
|
||||
- 'node_modules/**/*'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
|||
user_id = user.id
|
||||
user.destroy
|
||||
|
||||
get :new, { user_id: user_id }
|
||||
get :new, params: { user_id: user_id }
|
||||
|
||||
expect(response).to redirect_to root_path
|
||||
expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.')
|
||||
|
|
@ -30,7 +30,7 @@ describe AbuseReportsController do
|
|||
it 'redirects the reporter to the user\'s profile' do
|
||||
user.block
|
||||
|
||||
get :new, { user_id: user.id }
|
||||
get :new, params: { user_id: user.id }
|
||||
|
||||
expect(response).to redirect_to user
|
||||
expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.')
|
||||
|
|
@ -42,18 +42,18 @@ describe AbuseReportsController do
|
|||
context 'with valid attributes' do
|
||||
it 'saves the abuse report' do
|
||||
expect do
|
||||
post :create, abuse_report: attrs
|
||||
post :create, params: { abuse_report: attrs }
|
||||
end.to change { AbuseReport.count }.by(1)
|
||||
end
|
||||
|
||||
it 'calls notify' do
|
||||
expect_any_instance_of(AbuseReport).to receive(:notify)
|
||||
|
||||
post :create, abuse_report: attrs
|
||||
post :create, params: { abuse_report: attrs }
|
||||
end
|
||||
|
||||
it 'redirects back to the reported user' do
|
||||
post :create, abuse_report: attrs
|
||||
post :create, params: { abuse_report: attrs }
|
||||
|
||||
expect(response).to redirect_to user
|
||||
end
|
||||
|
|
@ -62,7 +62,7 @@ describe AbuseReportsController do
|
|||
context 'with invalid attributes' do
|
||||
it 'renders new' do
|
||||
attrs.delete(:user_id)
|
||||
post :create, abuse_report: attrs
|
||||
post :create, params: { abuse_report: attrs }
|
||||
|
||||
expect(response).to render_template(:new)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -52,35 +52,35 @@ describe Admin::ApplicationSettingsController do
|
|||
end
|
||||
|
||||
it 'updates the password_authentication_enabled_for_git setting' do
|
||||
put :update, application_setting: { password_authentication_enabled_for_git: "0" }
|
||||
put :update, params: { application_setting: { password_authentication_enabled_for_git: "0" } }
|
||||
|
||||
expect(response).to redirect_to(admin_application_settings_path)
|
||||
expect(ApplicationSetting.current.password_authentication_enabled_for_git).to eq(false)
|
||||
end
|
||||
|
||||
it 'updates the default_project_visibility for string value' do
|
||||
put :update, application_setting: { default_project_visibility: "20" }
|
||||
put :update, params: { application_setting: { default_project_visibility: "20" } }
|
||||
|
||||
expect(response).to redirect_to(admin_application_settings_path)
|
||||
expect(ApplicationSetting.current.default_project_visibility).to eq(Gitlab::VisibilityLevel::PUBLIC)
|
||||
end
|
||||
|
||||
it 'update the restricted levels for string values' do
|
||||
put :update, application_setting: { restricted_visibility_levels: %w[10 20] }
|
||||
put :update, params: { application_setting: { restricted_visibility_levels: %w[10 20] } }
|
||||
|
||||
expect(response).to redirect_to(admin_application_settings_path)
|
||||
expect(ApplicationSetting.current.restricted_visibility_levels).to eq([10, 20])
|
||||
end
|
||||
|
||||
it 'updates the restricted_visibility_levels when empty array is passed' do
|
||||
put :update, application_setting: { restricted_visibility_levels: [""] }
|
||||
put :update, params: { application_setting: { restricted_visibility_levels: [""] } }
|
||||
|
||||
expect(response).to redirect_to(admin_application_settings_path)
|
||||
expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty
|
||||
end
|
||||
|
||||
it 'updates the receive_max_input_size setting' do
|
||||
put :update, application_setting: { receive_max_input_size: "1024" }
|
||||
put :update, params: { application_setting: { receive_max_input_size: "1024" } }
|
||||
|
||||
expect(response).to redirect_to(admin_application_settings_path)
|
||||
expect(ApplicationSetting.current.receive_max_input_size).to eq(1024)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ describe Admin::ApplicationsController do
|
|||
|
||||
describe 'GET #edit' do
|
||||
it 'renders the application form' do
|
||||
get :edit, id: application.id
|
||||
get :edit, params: { id: application.id }
|
||||
|
||||
expect(response).to render_template :edit
|
||||
expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes)
|
||||
|
|
@ -31,7 +31,7 @@ describe Admin::ApplicationsController do
|
|||
create_params = attributes_for(:application, trusted: true)
|
||||
|
||||
expect do
|
||||
post :create, doorkeeper_application: create_params
|
||||
post :create, params: { doorkeeper_application: create_params }
|
||||
end.to change { Doorkeeper::Application.count }.by(1)
|
||||
|
||||
application = Doorkeeper::Application.last
|
||||
|
|
@ -42,7 +42,7 @@ describe Admin::ApplicationsController do
|
|||
|
||||
it 'renders the application form on errors' do
|
||||
expect do
|
||||
post :create, doorkeeper_application: attributes_for(:application).merge(redirect_uri: nil)
|
||||
post :create, params: { doorkeeper_application: attributes_for(:application).merge(redirect_uri: nil) }
|
||||
end.not_to change { Doorkeeper::Application.count }
|
||||
|
||||
expect(response).to render_template :new
|
||||
|
|
@ -52,7 +52,7 @@ describe Admin::ApplicationsController do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
it 'updates the application' do
|
||||
patch :update, id: application.id, doorkeeper_application: { redirect_uri: 'http://example.com/', trusted: true }
|
||||
patch :update, params: { id: application.id, doorkeeper_application: { redirect_uri: 'http://example.com/', trusted: true } }
|
||||
|
||||
application.reload
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ describe Admin::ApplicationsController do
|
|||
end
|
||||
|
||||
it 'renders the application form on errors' do
|
||||
patch :update, id: application.id, doorkeeper_application: { redirect_uri: nil }
|
||||
patch :update, params: { id: application.id, doorkeeper_application: { redirect_uri: nil } }
|
||||
|
||||
expect(response).to render_template :edit
|
||||
expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes)
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ describe Admin::GroupsController do
|
|||
describe 'DELETE #destroy' do
|
||||
it 'schedules a group destroy' do
|
||||
Sidekiq::Testing.fake! do
|
||||
expect { delete :destroy, id: project.group.path }.to change(GroupDestroyWorker.jobs, :size).by(1)
|
||||
expect { delete :destroy, params: { id: project.group.path } }.to change(GroupDestroyWorker.jobs, :size).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
it 'redirects to the admin group path' do
|
||||
delete :destroy, id: project.group.path
|
||||
delete :destroy, params: { id: project.group.path }
|
||||
|
||||
expect(response).to redirect_to(admin_groups_path)
|
||||
end
|
||||
|
|
@ -27,9 +27,11 @@ describe Admin::GroupsController do
|
|||
let(:group_user) { create(:user) }
|
||||
|
||||
it 'adds user to members' do
|
||||
put :members_update, id: group,
|
||||
user_ids: group_user.id,
|
||||
access_level: Gitlab::Access::GUEST
|
||||
put :members_update, params: {
|
||||
id: group,
|
||||
user_ids: group_user.id,
|
||||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to set_flash.to 'Users were successfully added.'
|
||||
expect(response).to redirect_to(admin_group_path(group))
|
||||
|
|
@ -37,18 +39,22 @@ describe Admin::GroupsController do
|
|||
end
|
||||
|
||||
it 'can add unlimited members' do
|
||||
put :members_update, id: group,
|
||||
user_ids: 1.upto(1000).to_a.join(','),
|
||||
access_level: Gitlab::Access::GUEST
|
||||
put :members_update, params: {
|
||||
id: group,
|
||||
user_ids: 1.upto(1000).to_a.join(','),
|
||||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to set_flash.to 'Users were successfully added.'
|
||||
expect(response).to redirect_to(admin_group_path(group))
|
||||
end
|
||||
|
||||
it 'adds no user to members' do
|
||||
put :members_update, id: group,
|
||||
user_ids: '',
|
||||
access_level: Gitlab::Access::GUEST
|
||||
put :members_update, params: {
|
||||
id: group,
|
||||
user_ids: '',
|
||||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to set_flash.to 'No users specified.'
|
||||
expect(response).to redirect_to(admin_group_path(group))
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ describe Admin::HooksController do
|
|||
merge_requests_events: true
|
||||
}
|
||||
|
||||
post :create, hook: hook_params
|
||||
post :create, params: { hook: hook_params }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(SystemHook.all.size).to eq(1)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe Admin::IdentitiesController do
|
|||
it 'repairs ldap blocks' do
|
||||
expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute)
|
||||
|
||||
put :update, user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' }
|
||||
put :update, params: { user_id: user.username, id: user.ldap_identity.id, identity: { provider: 'twitter' } }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ describe Admin::IdentitiesController do
|
|||
it 'repairs ldap blocks' do
|
||||
expect_any_instance_of(RepairLdapBlockedUserService).to receive(:execute)
|
||||
|
||||
delete :destroy, user_id: user.username, id: user.ldap_identity.id
|
||||
delete :destroy, params: { user_id: user.username, id: user.ldap_identity.id }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ describe Admin::ProjectsController do
|
|||
render_views
|
||||
|
||||
it 'retrieves the project for the given visibility level' do
|
||||
get :index, visibility_level: [Gitlab::VisibilityLevel::PUBLIC]
|
||||
get :index, params: { visibility_level: [Gitlab::VisibilityLevel::PUBLIC] }
|
||||
|
||||
expect(response.body).to match(project.name)
|
||||
end
|
||||
|
||||
it 'does not retrieve the project' do
|
||||
get :index, visibility_level: [Gitlab::VisibilityLevel::INTERNAL]
|
||||
get :index, params: { visibility_level: [Gitlab::VisibilityLevel::INTERNAL] }
|
||||
|
||||
expect(response.body).not_to match(project.name)
|
||||
end
|
||||
|
|
@ -47,7 +47,7 @@ describe Admin::ProjectsController do
|
|||
render_views
|
||||
|
||||
it 'renders show page' do
|
||||
get :show, namespace_id: project.namespace.path, id: project.path
|
||||
get :show, params: { namespace_id: project.namespace.path, id: project.path }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response.body).to match(project.name)
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ describe Admin::RunnersController do
|
|||
|
||||
describe '#show' do
|
||||
it 'shows a particular runner' do
|
||||
get :show, id: runner.id
|
||||
get :show, params: { id: runner.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it 'shows 404 for unknown runner' do
|
||||
get :show, id: 0
|
||||
get :show, params: { id: 0 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -34,7 +34,7 @@ describe Admin::RunnersController do
|
|||
new_desc = runner.description.swapcase
|
||||
|
||||
expect do
|
||||
post :update, id: runner.id, runner: { description: new_desc }
|
||||
post :update, params: { id: runner.id, runner: { description: new_desc } }
|
||||
end.to change { runner.ensure_runner_queue_value }
|
||||
|
||||
runner.reload
|
||||
|
|
@ -46,7 +46,7 @@ describe Admin::RunnersController do
|
|||
|
||||
describe '#destroy' do
|
||||
it 'destroys the runner' do
|
||||
delete :destroy, id: runner.id
|
||||
delete :destroy, params: { id: runner.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
|
||||
|
|
@ -58,7 +58,7 @@ describe Admin::RunnersController do
|
|||
runner.update(active: false)
|
||||
|
||||
expect do
|
||||
post :resume, id: runner.id
|
||||
post :resume, params: { id: runner.id }
|
||||
end.to change { runner.ensure_runner_queue_value }
|
||||
|
||||
runner.reload
|
||||
|
|
@ -73,7 +73,7 @@ describe Admin::RunnersController do
|
|||
runner.update(active: true)
|
||||
|
||||
expect do
|
||||
post :pause, id: runner.id
|
||||
post :pause, params: { id: runner.id }
|
||||
end.to change { runner.ensure_runner_queue_value }
|
||||
|
||||
runner.reload
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe Admin::ServicesController do
|
|||
end
|
||||
|
||||
it 'successfully displays the template' do
|
||||
get :edit, id: service.id
|
||||
get :edit, params: { id: service.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -44,7 +44,7 @@ describe Admin::ServicesController do
|
|||
it 'calls the propagation worker when service is active' do
|
||||
expect(PropagateServiceTemplateWorker).to receive(:perform_async).with(service.id)
|
||||
|
||||
put :update, id: service.id, service: { active: true }
|
||||
put :update, params: { id: service.id, service: { active: true } }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -52,7 +52,7 @@ describe Admin::ServicesController do
|
|||
it 'does not call the propagation worker when service is not active' do
|
||||
expect(PropagateServiceTemplateWorker).not_to receive(:perform_async)
|
||||
|
||||
put :update, id: service.id, service: { properties: {} }
|
||||
put :update, params: { id: service.id, service: { properties: {} } }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ describe Admin::SpamLogsController do
|
|||
|
||||
describe '#destroy' do
|
||||
it 'removes only the spam log when removing log' do
|
||||
expect { delete :destroy, id: first_spam.id }.to change { SpamLog.count }.by(-1)
|
||||
expect { delete :destroy, params: { id: first_spam.id } }.to change { SpamLog.count }.by(-1)
|
||||
expect(User.find(user.id)).to be_truthy
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it 'removes user and his spam logs when removing the user' do
|
||||
delete :destroy, id: first_spam.id, remove_user: true
|
||||
delete :destroy, params: { id: first_spam.id, remove_user: true }
|
||||
|
||||
expect(flash[:notice]).to eq "User #{user.username} was successfully removed."
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -40,7 +40,7 @@ describe Admin::SpamLogsController do
|
|||
allow_any_instance_of(AkismetService).to receive(:submit_ham).and_return(true)
|
||||
end
|
||||
it 'submits the log as ham' do
|
||||
post :mark_as_ham, id: first_spam.id
|
||||
post :mark_as_ham, params: { id: first_spam.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(SpamLog.find(first_spam.id).submitted_as_ham).to be_truthy
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'deletes user and ghosts their contributions' do
|
||||
delete :destroy, id: user.username, format: :json
|
||||
delete :destroy, params: { id: user.username }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(User.exists?(user.id)).to be_falsy
|
||||
|
|
@ -25,7 +25,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'deletes the user and their contributions when hard delete is specified' do
|
||||
delete :destroy, id: user.username, hard_delete: true, format: :json
|
||||
delete :destroy, params: { id: user.username, hard_delete: true }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(User.exists?(user.id)).to be_falsy
|
||||
|
|
@ -35,7 +35,7 @@ describe Admin::UsersController do
|
|||
|
||||
describe 'PUT block/:id' do
|
||||
it 'blocks user' do
|
||||
put :block, id: user.username
|
||||
put :block, params: { id: user.username }
|
||||
user.reload
|
||||
expect(user.blocked?).to be_truthy
|
||||
expect(flash[:notice]).to eq 'Successfully blocked'
|
||||
|
|
@ -51,7 +51,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'does not unblock user' do
|
||||
put :unblock, id: user.username
|
||||
put :unblock, params: { id: user.username }
|
||||
user.reload
|
||||
expect(user.blocked?).to be_truthy
|
||||
expect(flash[:alert]).to eq 'This user cannot be unlocked manually from GitLab'
|
||||
|
|
@ -64,7 +64,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'unblocks user' do
|
||||
put :unblock, id: user.username
|
||||
put :unblock, params: { id: user.username }
|
||||
user.reload
|
||||
expect(user.blocked?).to be_falsey
|
||||
expect(flash[:notice]).to eq 'Successfully unblocked'
|
||||
|
|
@ -79,7 +79,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'unlocks user' do
|
||||
put :unlock, id: user.username
|
||||
put :unlock, params: { id: user.username }
|
||||
user.reload
|
||||
expect(user.access_locked?).to be_falsey
|
||||
end
|
||||
|
|
@ -93,7 +93,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it 'confirms user' do
|
||||
put :confirm, id: user.username
|
||||
put :confirm, params: { id: user.username }
|
||||
user.reload
|
||||
expect(user.confirmed?).to be_truthy
|
||||
end
|
||||
|
|
@ -121,17 +121,17 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
def go
|
||||
patch :disable_two_factor, id: user.to_param
|
||||
patch :disable_two_factor, params: { id: user.to_param }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST create' do
|
||||
it 'creates the user' do
|
||||
expect { post :create, user: attributes_for(:user) }.to change { User.count }.by(1)
|
||||
expect { post :create, params: { user: attributes_for(:user) } }.to change { User.count }.by(1)
|
||||
end
|
||||
|
||||
it 'shows only one error message for an invalid email' do
|
||||
post :create, user: attributes_for(:user, email: 'bogus')
|
||||
post :create, params: { user: attributes_for(:user, email: 'bogus') }
|
||||
expect(assigns[:user].errors).to contain_exactly("Email is invalid")
|
||||
end
|
||||
end
|
||||
|
|
@ -147,7 +147,7 @@ describe Admin::UsersController do
|
|||
}
|
||||
}
|
||||
|
||||
post :update, params
|
||||
post :update, params: params
|
||||
end
|
||||
|
||||
context 'when the admin changes his own password' do
|
||||
|
|
@ -227,13 +227,13 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it "shows a notice" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(flash[:alert]).to eq("You cannot impersonate a blocked user")
|
||||
end
|
||||
|
||||
it "doesn't sign us in as the user" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(warden.user).to eq(admin)
|
||||
end
|
||||
|
|
@ -241,25 +241,25 @@ describe Admin::UsersController do
|
|||
|
||||
context "when the user is not blocked" do
|
||||
it "stores the impersonator in the session" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(session[:impersonator_id]).to eq(admin.id)
|
||||
end
|
||||
|
||||
it "signs us in as the user" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(warden.user).to eq(user)
|
||||
end
|
||||
|
||||
it "redirects to root" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
|
||||
it "shows a notice" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(flash[:alert]).to eq("You are now impersonating #{user.username}")
|
||||
end
|
||||
|
|
@ -271,7 +271,7 @@ describe Admin::UsersController do
|
|||
end
|
||||
|
||||
it "shows error page" do
|
||||
post :impersonate, id: user.username
|
||||
post :impersonate, params: { id: user.username }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -522,13 +522,13 @@ describe ApplicationController do
|
|||
end
|
||||
|
||||
it 'renders a 403 when a message is passed to access denied' do
|
||||
get :index, message: 'None shall pass'
|
||||
get :index, params: { message: 'None shall pass' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
||||
it 'renders a status passed to access denied' do
|
||||
get :index, status: 401
|
||||
get :index, params: { status: 401 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(401)
|
||||
end
|
||||
|
|
@ -548,7 +548,7 @@ describe ApplicationController do
|
|||
end
|
||||
|
||||
context 'html' do
|
||||
subject { get :index, text: "hi \255" }
|
||||
subject { get :index, params: { text: "hi \255" } }
|
||||
|
||||
it 'renders 412' do
|
||||
expect { subject }.to raise_error(ActionController::BadRequest)
|
||||
|
|
@ -556,7 +556,7 @@ describe ApplicationController do
|
|||
end
|
||||
|
||||
context 'js' do
|
||||
subject { get :index, text: "hi \255", format: :js }
|
||||
subject { get :index, format: :js, params: { text: "hi \255" } }
|
||||
|
||||
it 'renders 412' do
|
||||
expect { subject }.to raise_error(ActionController::BadRequest)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with project ID' do
|
||||
before do
|
||||
get(:users, project_id: project.id)
|
||||
get(:users, params: { project_id: project.id })
|
||||
end
|
||||
|
||||
it 'returns the project members' do
|
||||
|
|
@ -27,7 +27,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with unknown project' do
|
||||
before do
|
||||
get(:users, project_id: 'unknown')
|
||||
get(:users, params: { project_id: 'unknown' })
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
|
|
@ -44,7 +44,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with group ID' do
|
||||
before do
|
||||
get(:users, group_id: group.id)
|
||||
get(:users, params: { group_id: group.id })
|
||||
end
|
||||
|
||||
it 'returns the group members' do
|
||||
|
|
@ -56,7 +56,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with unknown group ID' do
|
||||
before do
|
||||
get(:users, group_id: 'unknown')
|
||||
get(:users, params: { group_id: 'unknown' })
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
|
|
@ -72,7 +72,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with project ID' do
|
||||
before do
|
||||
get(:users, project_id: project.id, current_user: true)
|
||||
get(:users, params: { project_id: project.id, current_user: true })
|
||||
end
|
||||
|
||||
it 'returns the project members and non-members' do
|
||||
|
|
@ -100,7 +100,7 @@ describe AutocompleteController do
|
|||
user1 = create(:user, username: 'user1', name: 'Ian')
|
||||
|
||||
sign_in(user)
|
||||
get(:users, search: 'user')
|
||||
get(:users, params: { search: 'user' })
|
||||
|
||||
response_usernames = json_response.map { |user| user['username'] }
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ describe AutocompleteController do
|
|||
describe 'GET #users with public project' do
|
||||
before do
|
||||
public_project.add_guest(user)
|
||||
get(:users, project_id: public_project.id)
|
||||
get(:users, params: { project_id: public_project.id })
|
||||
end
|
||||
|
||||
it { expect(json_response).to be_kind_of(Array) }
|
||||
|
|
@ -137,7 +137,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with project' do
|
||||
before do
|
||||
get(:users, project_id: project.id)
|
||||
get(:users, params: { project_id: project.id })
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
|
|
@ -145,7 +145,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with unknown project' do
|
||||
before do
|
||||
get(:users, project_id: 'unknown')
|
||||
get(:users, params: { project_id: 'unknown' })
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
|
|
@ -154,7 +154,7 @@ describe AutocompleteController do
|
|||
describe 'GET #users with inaccessible group' do
|
||||
before do
|
||||
project.add_guest(user)
|
||||
get(:users, group_id: user.namespace.id)
|
||||
get(:users, params: { group_id: user.namespace.id })
|
||||
end
|
||||
|
||||
it { expect(response).to have_gitlab_http_status(404) }
|
||||
|
|
@ -171,7 +171,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #users with todo filter' do
|
||||
it 'gives an array of users' do
|
||||
get :users, todo_filter: true
|
||||
get :users, params: { todo_filter: true }
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(json_response).to be_kind_of(Array)
|
||||
|
|
@ -186,13 +186,13 @@ describe AutocompleteController do
|
|||
end
|
||||
|
||||
it 'includes the author' do
|
||||
get(:users, author_id: non_member.id)
|
||||
get(:users, params: { author_id: non_member.id })
|
||||
|
||||
expect(json_response.first["username"]).to eq non_member.username
|
||||
end
|
||||
|
||||
it 'rejects non existent user ids' do
|
||||
get(:users, author_id: 99999)
|
||||
get(:users, params: { author_id: 99999 })
|
||||
|
||||
expect(json_response.collect { |u| u['id'] }).not_to include(99999)
|
||||
end
|
||||
|
|
@ -200,7 +200,7 @@ describe AutocompleteController do
|
|||
|
||||
context 'without authenticating' do
|
||||
it 'returns empty result' do
|
||||
get(:users, author_id: non_member.id)
|
||||
get(:users, params: { author_id: non_member.id })
|
||||
|
||||
expect(json_response).to be_empty
|
||||
end
|
||||
|
|
@ -213,7 +213,7 @@ describe AutocompleteController do
|
|||
end
|
||||
|
||||
it 'skips the user IDs passed' do
|
||||
get(:users, skip_users: [user, user2].map(&:id))
|
||||
get(:users, params: { skip_users: [user, user2].map(&:id) })
|
||||
|
||||
response_user_ids = json_response.map { |user| user['id'] }
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #projects with project ID' do
|
||||
before do
|
||||
get(:projects, project_id: project.id)
|
||||
get(:projects, params: { project_id: project.id })
|
||||
end
|
||||
|
||||
it 'returns projects' do
|
||||
|
|
@ -259,7 +259,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #projects with project ID and search' do
|
||||
before do
|
||||
get(:projects, project_id: project.id, search: 'rugged')
|
||||
get(:projects, params: { project_id: project.id, search: 'rugged' })
|
||||
end
|
||||
|
||||
it 'returns projects' do
|
||||
|
|
@ -283,7 +283,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #projects with project ID' do
|
||||
before do
|
||||
get(:projects, project_id: project.id)
|
||||
get(:projects, params: { project_id: project.id })
|
||||
end
|
||||
|
||||
it 'returns projects' do
|
||||
|
|
@ -305,7 +305,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #projects with project ID and offset_id' do
|
||||
before do
|
||||
get(:projects, project_id: project.id, offset_id: authorized_project.id)
|
||||
get(:projects, params: { project_id: project.id, offset_id: authorized_project.id })
|
||||
end
|
||||
|
||||
it 'returns projects' do
|
||||
|
|
@ -324,7 +324,7 @@ describe AutocompleteController do
|
|||
|
||||
describe 'GET #projects with project ID' do
|
||||
before do
|
||||
get(:projects, project_id: project.id)
|
||||
get(:projects, params: { project_id: project.id })
|
||||
end
|
||||
|
||||
it 'returns no projects' do
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ describe Boards::IssuesController do
|
|||
params[:project_id] = project
|
||||
end
|
||||
|
||||
get :index, params.compact
|
||||
get :index, params: params.compact
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -230,9 +230,11 @@ describe Boards::IssuesController do
|
|||
def create_issue(user:, board:, list:, title:)
|
||||
sign_in(user)
|
||||
|
||||
post :create, board_id: board.to_param,
|
||||
list_id: list.to_param,
|
||||
issue: { title: title, project_id: project.id },
|
||||
post :create, params: {
|
||||
board_id: board.to_param,
|
||||
list_id: list.to_param,
|
||||
issue: { title: title, project_id: project.id }
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -291,12 +293,14 @@ describe Boards::IssuesController do
|
|||
def move(user:, board:, issue:, from_list_id:, to_list_id:)
|
||||
sign_in(user)
|
||||
|
||||
patch :update, namespace_id: project.namespace.to_param,
|
||||
project_id: project.id,
|
||||
board_id: board.to_param,
|
||||
id: issue.id,
|
||||
from_list_id: from_list_id,
|
||||
to_list_id: to_list_id,
|
||||
patch :update, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.id,
|
||||
board_id: board.to_param,
|
||||
id: issue.id,
|
||||
from_list_id: from_list_id,
|
||||
to_list_id: to_list_id
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,9 +46,11 @@ describe Boards::ListsController do
|
|||
def read_board_list(user:, board:)
|
||||
sign_in(user)
|
||||
|
||||
get :index, namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param,
|
||||
get :index, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -103,10 +105,12 @@ describe Boards::ListsController do
|
|||
def create_board_list(user:, board:, label_id:)
|
||||
sign_in(user)
|
||||
|
||||
post :create, namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param,
|
||||
list: { label_id: label_id },
|
||||
post :create, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param,
|
||||
list: { label_id: label_id }
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -201,10 +205,12 @@ describe Boards::ListsController do
|
|||
def remove_board_list(user:, board:, list:)
|
||||
sign_in(user)
|
||||
|
||||
delete :destroy, namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param,
|
||||
id: list.to_param,
|
||||
delete :destroy, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param,
|
||||
id: list.to_param
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -245,9 +251,11 @@ describe Boards::ListsController do
|
|||
def generate_default_lists(user:, board:)
|
||||
sign_in(user)
|
||||
|
||||
post :generate, namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param,
|
||||
post :generate, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
board_id: board.to_param
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ describe ControllerWithCrossProjectAccessCheck do
|
|||
end
|
||||
|
||||
it 'correctly renders an action that does not require cross project access' do
|
||||
get :show, id: 'nothing'
|
||||
get :show, params: { id: 'nothing' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -131,13 +131,13 @@ describe ControllerWithCrossProjectAccessCheck do
|
|||
end
|
||||
|
||||
it 'does not skip the check on an action that is not skipped' do
|
||||
get :show, id: 'hello'
|
||||
get :show, params: { id: 'hello' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
||||
it 'does not skip the check on an action that was not defined to skip' do
|
||||
get :edit, id: 'hello'
|
||||
get :edit, params: { id: 'hello' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ describe GroupTree do
|
|||
other_group = create(:group, name: 'filter')
|
||||
other_group.add_owner(user)
|
||||
|
||||
get :index, filter: 'filt', format: :json
|
||||
get :index, params: { filter: 'filt' }, format: :json
|
||||
|
||||
expect(assigns(:groups)).to contain_exactly(other_group)
|
||||
end
|
||||
|
|
@ -40,7 +40,7 @@ describe GroupTree do
|
|||
it 'contains only the subgroup when a parent was given' do
|
||||
subgroup = create(:group, :public, parent: group)
|
||||
|
||||
get :index, parent_id: group.id, format: :json
|
||||
get :index, params: { parent_id: group.id }, format: :json
|
||||
|
||||
expect(assigns(:groups)).to contain_exactly(subgroup)
|
||||
end
|
||||
|
|
@ -48,7 +48,7 @@ describe GroupTree do
|
|||
it 'allows filtering for subgroups and includes the parents for rendering' do
|
||||
subgroup = create(:group, :public, parent: group, name: 'filter')
|
||||
|
||||
get :index, filter: 'filt', format: :json
|
||||
get :index, params: { filter: 'filt' }, format: :json
|
||||
|
||||
expect(assigns(:groups)).to contain_exactly(group, subgroup)
|
||||
end
|
||||
|
|
@ -59,7 +59,7 @@ describe GroupTree do
|
|||
subgroup.add_developer(user)
|
||||
_other_subgroup = create(:group, :private, parent: parent, name: 'filte')
|
||||
|
||||
get :index, filter: 'filt', format: :json
|
||||
get :index, params: { filter: 'filt' }, format: :json
|
||||
|
||||
expect(assigns(:groups)).to contain_exactly(parent, subgroup)
|
||||
end
|
||||
|
|
@ -70,7 +70,7 @@ describe GroupTree do
|
|||
subgroup = create(:group, :public, parent: group)
|
||||
search_result = create(:group, :public, name: 'result', parent: subgroup)
|
||||
|
||||
get :index, filter: 'resu', format: :json
|
||||
get :index, params: { filter: 'resu' }, format: :json
|
||||
|
||||
expect(assigns(:groups)).to contain_exactly(group, subgroup, search_result)
|
||||
end
|
||||
|
|
@ -87,7 +87,7 @@ describe GroupTree do
|
|||
it 'expands the tree when filtering' do
|
||||
subgroup = create(:group, :public, parent: group, name: 'filter')
|
||||
|
||||
get :index, filter: 'filt', format: :json
|
||||
get :index, params: { filter: 'filt' }, format: :json
|
||||
|
||||
children_response = json_response.first['children']
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ describe LfsRequest do
|
|||
|
||||
describe '#storage_project' do
|
||||
it 'assigns the project as storage project' do
|
||||
get :show, id: project.id
|
||||
get :show, params: { id: project.id }
|
||||
|
||||
expect(assigns(:storage_project)).to eq(project)
|
||||
end
|
||||
|
|
@ -42,7 +42,7 @@ describe LfsRequest do
|
|||
it 'assigns the source of a forked project' do
|
||||
forked_project = fork_project(project)
|
||||
|
||||
get :show, id: forked_project.id
|
||||
get :show, params: { id: forked_project.id }
|
||||
|
||||
expect(assigns(:storage_project)).to eq(project)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ describe Dashboard::GroupsController do
|
|||
end
|
||||
|
||||
it 'renders only groups the user is a member of when searching hierarchy correctly' do
|
||||
get :index, filter: 'chef', format: :json
|
||||
get :index, params: { filter: 'chef' }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
all_groups = [top_level_result, top_level_a, sub_level_result_a]
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ describe Dashboard::MilestonesController do
|
|||
render_views
|
||||
|
||||
def view_milestone
|
||||
get :show, id: milestone.safe_title, title: milestone.title
|
||||
get :show, params: { id: milestone.safe_title, title: milestone.title }
|
||||
end
|
||||
|
||||
it 'shows milestone page' do
|
||||
|
|
|
|||
|
|
@ -16,19 +16,19 @@ describe Dashboard::TodosController do
|
|||
it 'renders 404 when user does not have read access on given project' do
|
||||
unauthorized_project = create(:project, :private)
|
||||
|
||||
get :index, project_id: unauthorized_project.id
|
||||
get :index, params: { project_id: unauthorized_project.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'renders 404 when given project does not exists' do
|
||||
get :index, project_id: 999
|
||||
get :index, params: { project_id: 999 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'renders 200 when filtering for "any project" todos' do
|
||||
get :index, project_id: ''
|
||||
get :index, params: { project_id: '' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -36,7 +36,7 @@ describe Dashboard::TodosController do
|
|||
it 'renders 200 when user has access on given project' do
|
||||
authorized_project = create(:project, :public)
|
||||
|
||||
get :index, project_id: authorized_project.id
|
||||
get :index, params: { project_id: authorized_project.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -46,7 +46,7 @@ describe Dashboard::TodosController do
|
|||
it 'renders 404 when user does not have read access on given group' do
|
||||
unauthorized_group = create(:group, :private)
|
||||
|
||||
get :index, group_id: unauthorized_group.id
|
||||
get :index, params: { group_id: unauthorized_group.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -62,13 +62,13 @@ describe Dashboard::TodosController do
|
|||
end
|
||||
|
||||
it 'redirects to last_page if page number is larger than number of pages' do
|
||||
get :index, page: (last_page + 1).to_param
|
||||
get :index, params: { page: (last_page + 1).to_param }
|
||||
|
||||
expect(response).to redirect_to(dashboard_todos_path(page: last_page))
|
||||
end
|
||||
|
||||
it 'goes to the correct page' do
|
||||
get :index, page: last_page
|
||||
get :index, params: { page: last_page }
|
||||
|
||||
expect(assigns(:todos).current_page).to eq(last_page)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
@ -76,7 +76,7 @@ describe Dashboard::TodosController do
|
|||
|
||||
it 'does not redirect to external sites when provided a host field' do
|
||||
external_host = "www.example.com"
|
||||
get :index, page: (last_page + 1).to_param, host: external_host
|
||||
get :index, params: { page: (last_page + 1).to_param, host: external_host }
|
||||
|
||||
expect(response).to redirect_to(dashboard_todos_path(page: last_page))
|
||||
end
|
||||
|
|
@ -87,7 +87,7 @@ describe Dashboard::TodosController do
|
|||
|
||||
expect(user).to receive(:todos_pending_count).and_call_original
|
||||
|
||||
get :index, page: (last_page + 1).to_param, sort: :created_asc
|
||||
get :index, params: { page: (last_page + 1).to_param, sort: :created_asc }
|
||||
|
||||
expect(response).to redirect_to(dashboard_todos_path(page: last_page, sort: :created_asc))
|
||||
end
|
||||
|
|
@ -99,7 +99,7 @@ describe Dashboard::TodosController do
|
|||
|
||||
expect(user).not_to receive(:todos_pending_count)
|
||||
|
||||
get :index, page: (last_page + 1).to_param, project_id: project.id
|
||||
get :index, params: { page: (last_page + 1).to_param, project_id: project.id }
|
||||
|
||||
expect(response).to redirect_to(dashboard_todos_path(page: last_page, project_id: project.id))
|
||||
end
|
||||
|
|
@ -111,7 +111,7 @@ describe Dashboard::TodosController do
|
|||
let(:todo) { create(:todo, :done, user: user, project: project, author: author) }
|
||||
|
||||
it 'restores the todo to pending state' do
|
||||
patch :restore, id: todo.id
|
||||
patch :restore, params: { id: todo.id }
|
||||
|
||||
expect(todo.reload).to be_pending
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
@ -123,7 +123,7 @@ describe Dashboard::TodosController do
|
|||
let(:todos) { create_list(:todo, 2, :done, user: user, project: project, author: author) }
|
||||
|
||||
it 'restores the todos to pending state' do
|
||||
patch :bulk_restore, ids: todos.map(&:id)
|
||||
patch :bulk_restore, params: { ids: todos.map(&:id) }
|
||||
|
||||
todos.each do |todo|
|
||||
expect(todo.reload).to be_pending
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ describe Explore::ProjectsController do
|
|||
end
|
||||
|
||||
it 'sorts by last updated' do
|
||||
get :trending, sort: 'updated_desc'
|
||||
get :trending, params: { sort: 'updated_desc' }
|
||||
|
||||
expect(assigns(:projects)).to eq [project2, project1]
|
||||
end
|
||||
|
||||
it 'sorts by oldest updated' do
|
||||
get :trending, sort: 'updated_asc'
|
||||
get :trending, params: { sort: 'updated_asc' }
|
||||
|
||||
expect(assigns(:projects)).to eq [project1, project2]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe GoogleApi::AuthorizationsController do
|
|||
let(:token) { 'token' }
|
||||
let(:expires_at) { 1.hour.since.strftime('%s') }
|
||||
|
||||
subject { get :callback, code: 'xxx', state: @state }
|
||||
subject { get :callback, params: { code: 'xxx', state: @state } }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ describe GraphqlController do
|
|||
}
|
||||
QUERY
|
||||
|
||||
post :execute, query: query, operationName: 'Echo', variables: variables, private_token: private_token
|
||||
post :execute, params: { query: query, operationName: 'Echo', variables: variables, private_token: private_token }
|
||||
end
|
||||
|
||||
def query_response
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ describe Groups::AvatarsController do
|
|||
end
|
||||
|
||||
it 'removes avatar from DB calling destroy' do
|
||||
delete :destroy, group_id: group.path
|
||||
delete :destroy, params: { group_id: group.path }
|
||||
@group = assigns(:group)
|
||||
expect(@group.avatar.present?).to be_falsey
|
||||
expect(@group).to be_valid
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ describe Groups::BoardsController do
|
|||
end
|
||||
|
||||
def list_boards(format: :html)
|
||||
get :index, group_id: group, format: format
|
||||
get :index, params: { group_id: group }, format: format
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -183,8 +183,10 @@ describe Groups::BoardsController do
|
|||
end
|
||||
|
||||
def read_board(board:, format: :html)
|
||||
get :show, group_id: group,
|
||||
id: board.to_param,
|
||||
get :show, params: {
|
||||
group_id: group,
|
||||
id: board.to_param
|
||||
},
|
||||
format: format
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe Groups::ChildrenController do
|
|||
end
|
||||
|
||||
it 'shows all children' do
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(public_project, private_project)
|
||||
end
|
||||
|
|
@ -26,7 +26,7 @@ describe Groups::ChildrenController do
|
|||
group_member.destroy!
|
||||
private_project.add_guest(user)
|
||||
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(public_project, private_project)
|
||||
end
|
||||
|
|
@ -35,7 +35,7 @@ describe Groups::ChildrenController do
|
|||
|
||||
context 'as a guest' do
|
||||
it 'shows the public children' do
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(public_project)
|
||||
end
|
||||
|
|
@ -54,7 +54,7 @@ describe Groups::ChildrenController do
|
|||
end
|
||||
|
||||
it 'shows all children' do
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(public_subgroup, private_subgroup, public_project, private_project)
|
||||
end
|
||||
|
|
@ -65,7 +65,7 @@ describe Groups::ChildrenController do
|
|||
private_subgroup.add_guest(user)
|
||||
private_project.add_guest(user)
|
||||
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(public_subgroup, private_subgroup, public_project, private_project)
|
||||
end
|
||||
|
|
@ -74,7 +74,7 @@ describe Groups::ChildrenController do
|
|||
|
||||
context 'as a guest' do
|
||||
it 'shows the public children' do
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(public_subgroup, public_project)
|
||||
end
|
||||
|
|
@ -84,7 +84,7 @@ describe Groups::ChildrenController do
|
|||
it 'expands the tree for matching projects' do
|
||||
project = create(:project, :public, namespace: public_subgroup, name: 'filterme')
|
||||
|
||||
get :index, group_id: group.to_param, filter: 'filter', format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'filter' }, format: :json
|
||||
|
||||
group_json = json_response.first
|
||||
project_json = group_json['children'].first
|
||||
|
|
@ -96,7 +96,7 @@ describe Groups::ChildrenController do
|
|||
it 'expands the tree for matching subgroups' do
|
||||
matched_group = create(:group, :public, parent: public_subgroup, name: 'filterme')
|
||||
|
||||
get :index, group_id: group.to_param, filter: 'filter', format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'filter' }, format: :json
|
||||
|
||||
group_json = json_response.first
|
||||
matched_group_json = group_json['children'].first
|
||||
|
|
@ -113,7 +113,7 @@ describe Groups::ChildrenController do
|
|||
l3_subgroup = create(:group, :public, parent: l2_subgroup, path: 'wifi-group')
|
||||
matched_project_2 = create(:project, :public, namespace: l3_subgroup, name: 'mobile')
|
||||
|
||||
get :index, group_id: group.to_param, filter: 'mobile', format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'mobile' }, format: :json
|
||||
|
||||
shared_group_json = json_response.first
|
||||
expect(shared_group_json['id']).to eq(shared_subgroup.id)
|
||||
|
|
@ -136,7 +136,7 @@ describe Groups::ChildrenController do
|
|||
l2_subgroup = create(:group, :public, parent: subgroup)
|
||||
create(:project, :public, namespace: l2_subgroup, name: 'test')
|
||||
|
||||
get :index, group_id: subgroup.to_param, filter: 'test', format: :json
|
||||
get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
|
@ -144,7 +144,7 @@ describe Groups::ChildrenController do
|
|||
it 'returns an array with one element when only one result is matched' do
|
||||
create(:project, :public, namespace: group, name: 'match')
|
||||
|
||||
get :index, group_id: group.to_param, filter: 'match', format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'match' }, format: :json
|
||||
|
||||
expect(json_response).to be_kind_of(Array)
|
||||
expect(json_response.size).to eq(1)
|
||||
|
|
@ -155,7 +155,7 @@ describe Groups::ChildrenController do
|
|||
l2_subgroup = create(:group, :public, parent: subgroup)
|
||||
create(:project, :public, namespace: l2_subgroup, name: 'no-match')
|
||||
|
||||
get :index, group_id: subgroup.to_param, filter: 'test', format: :json
|
||||
get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json
|
||||
|
||||
expect(json_response).to eq([])
|
||||
end
|
||||
|
|
@ -179,7 +179,7 @@ describe Groups::ChildrenController do
|
|||
end
|
||||
group_to_nest.update!(parent: subgroup)
|
||||
|
||||
get :index, group_id: group.to_param, filter: 'filter', per_page: 3, format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 3 }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -187,7 +187,7 @@ describe Groups::ChildrenController do
|
|||
it 'includes pagination headers' do
|
||||
2.times { |i| create(:group, :public, parent: public_subgroup, name: "filterme#{i}") }
|
||||
|
||||
get :index, group_id: group.to_param, filter: 'filter', per_page: 1, format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 1 }, format: :json
|
||||
|
||||
expect(response).to include_pagination_headers
|
||||
end
|
||||
|
|
@ -203,7 +203,7 @@ describe Groups::ChildrenController do
|
|||
let(:expected_queries_per_project) { 0 }
|
||||
|
||||
def get_list
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
end
|
||||
|
||||
it 'queries the expected amount for a group row' do
|
||||
|
|
@ -227,7 +227,7 @@ describe Groups::ChildrenController do
|
|||
let(:extra_queries_for_hierarchies) { 1 }
|
||||
|
||||
def get_filtered_list
|
||||
get :index, group_id: group.to_param, filter: 'filter', format: :json
|
||||
get :index, params: { group_id: group.to_param, filter: 'filter' }, format: :json
|
||||
end
|
||||
|
||||
it 'queries the expected amount when nested rows are increased for a group' do
|
||||
|
|
@ -276,13 +276,13 @@ describe Groups::ChildrenController do
|
|||
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group ) }
|
||||
|
||||
it 'has projects on the first page' do
|
||||
get :index, group_id: group.to_param, sort: 'id_desc', format: :json
|
||||
get :index, params: { group_id: group.to_param, sort: 'id_desc' }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(*first_page_projects)
|
||||
end
|
||||
|
||||
it 'has projects on the second page' do
|
||||
get :index, group_id: group.to_param, sort: 'id_desc', page: 2, format: :json
|
||||
get :index, params: { group_id: group.to_param, sort: 'id_desc', page: 2 }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(other_project)
|
||||
end
|
||||
|
|
@ -294,13 +294,13 @@ describe Groups::ChildrenController do
|
|||
let!(:next_page_projects) { create_list(:project, per_page, :public, namespace: group) }
|
||||
|
||||
it 'contains all subgroups' do
|
||||
get :index, group_id: group.to_param, sort: 'id_asc', format: :json
|
||||
get :index, params: { group_id: group.to_param, sort: 'id_asc' }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(*first_page_subgroups)
|
||||
end
|
||||
|
||||
it 'contains the project and group on the second page' do
|
||||
get :index, group_id: group.to_param, sort: 'id_asc', page: 2, format: :json
|
||||
get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json
|
||||
|
||||
expect(assigns(:children)).to contain_exactly(other_subgroup, *next_page_projects.take(per_page - 1))
|
||||
end
|
||||
|
|
@ -310,7 +310,7 @@ describe Groups::ChildrenController do
|
|||
let!(:first_page_projects) { create_list(:project, per_page, :public, namespace: group) }
|
||||
|
||||
it 'correctly calculates the counts' do
|
||||
get :index, group_id: group.to_param, sort: 'id_asc', page: 2, format: :json
|
||||
get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ describe Groups::Clusters::ApplicationsController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create, params.merge(group_id: group)
|
||||
post :create, params: params.merge(group_id: group)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Groups::ClustersController do
|
|||
|
||||
describe 'GET index' do
|
||||
def go(params = {})
|
||||
get :index, params.reverse_merge(group_id: group)
|
||||
get :index, params: params.reverse_merge(group_id: group)
|
||||
end
|
||||
|
||||
context 'when feature flag is not enabled' do
|
||||
|
|
@ -104,7 +104,7 @@ describe Groups::ClustersController do
|
|||
|
||||
describe 'GET new' do
|
||||
def go
|
||||
get :new, group_id: group
|
||||
get :new, params: { group_id: group }
|
||||
end
|
||||
|
||||
describe 'functionality for new cluster' do
|
||||
|
|
@ -198,7 +198,7 @@ describe Groups::ClustersController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create_gcp, params.merge(group_id: group)
|
||||
post :create_gcp, params: params.merge(group_id: group)
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -287,7 +287,7 @@ describe Groups::ClustersController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create_user, params.merge(group_id: group)
|
||||
post :create_user, params: params.merge(group_id: group)
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -353,8 +353,10 @@ describe Groups::ClustersController do
|
|||
|
||||
def go
|
||||
get :cluster_status,
|
||||
group_id: group.to_param,
|
||||
id: cluster,
|
||||
params: {
|
||||
group_id: group.to_param,
|
||||
id: cluster
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
|
|
@ -390,8 +392,10 @@ describe Groups::ClustersController do
|
|||
|
||||
def go
|
||||
get :show,
|
||||
group_id: group,
|
||||
id: cluster
|
||||
params: {
|
||||
group_id: group,
|
||||
id: cluster
|
||||
}
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -417,7 +421,7 @@ describe Groups::ClustersController do
|
|||
|
||||
describe 'PUT update' do
|
||||
def go(format: :html)
|
||||
put :update, params.merge(
|
||||
put :update, params: params.merge(
|
||||
group_id: group.to_param,
|
||||
id: cluster,
|
||||
format: format
|
||||
|
|
@ -505,8 +509,10 @@ describe Groups::ClustersController do
|
|||
|
||||
def go
|
||||
delete :destroy,
|
||||
group_id: group,
|
||||
id: cluster
|
||||
params: {
|
||||
group_id: group,
|
||||
id: cluster
|
||||
}
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe Groups::GroupMembersController do
|
|||
|
||||
describe 'GET index' do
|
||||
it 'renders index with 200 status code' do
|
||||
get :index, group_id: group
|
||||
get :index, params: { group_id: group }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template(:index)
|
||||
|
|
@ -26,9 +26,11 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'returns 403' do
|
||||
post :create, group_id: group,
|
||||
user_ids: group_user.id,
|
||||
access_level: Gitlab::Access::GUEST
|
||||
post :create, params: {
|
||||
group_id: group,
|
||||
user_ids: group_user.id,
|
||||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
expect(group.users).not_to include group_user
|
||||
|
|
@ -41,9 +43,11 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'adds user to members' do
|
||||
post :create, group_id: group,
|
||||
user_ids: group_user.id,
|
||||
access_level: Gitlab::Access::GUEST
|
||||
post :create, params: {
|
||||
group_id: group,
|
||||
user_ids: group_user.id,
|
||||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to set_flash.to 'Users were successfully added.'
|
||||
expect(response).to redirect_to(group_group_members_path(group))
|
||||
|
|
@ -51,9 +55,11 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'adds no user to members' do
|
||||
post :create, group_id: group,
|
||||
user_ids: '',
|
||||
access_level: Gitlab::Access::GUEST
|
||||
post :create, params: {
|
||||
group_id: group,
|
||||
user_ids: '',
|
||||
access_level: Gitlab::Access::GUEST
|
||||
}
|
||||
|
||||
expect(response).to set_flash.to 'No users specified.'
|
||||
expect(response).to redirect_to(group_group_members_path(group))
|
||||
|
|
@ -90,7 +96,7 @@ describe Groups::GroupMembersController do
|
|||
|
||||
context 'when member is not found' do
|
||||
it 'returns 403' do
|
||||
delete :destroy, group_id: group, id: 42
|
||||
delete :destroy, params: { group_id: group, id: 42 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
|
@ -103,7 +109,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'returns 403' do
|
||||
delete :destroy, group_id: group, id: member
|
||||
delete :destroy, params: { group_id: group, id: member }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
expect(group.members).to include member
|
||||
|
|
@ -116,7 +122,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it '[HTML] removes user from members' do
|
||||
delete :destroy, group_id: group, id: member
|
||||
delete :destroy, params: { group_id: group, id: member }
|
||||
|
||||
expect(response).to set_flash.to 'User was successfully removed from group.'
|
||||
expect(response).to redirect_to(group_group_members_path(group))
|
||||
|
|
@ -140,7 +146,7 @@ describe Groups::GroupMembersController do
|
|||
|
||||
context 'when member is not found' do
|
||||
it 'returns 404' do
|
||||
delete :leave, group_id: group
|
||||
delete :leave, params: { group_id: group }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -153,7 +159,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'removes user from members' do
|
||||
delete :leave, group_id: group
|
||||
delete :leave, params: { group_id: group }
|
||||
|
||||
expect(response).to set_flash.to "You left the \"#{group.name}\" group."
|
||||
expect(response).to redirect_to(dashboard_groups_path)
|
||||
|
|
@ -161,7 +167,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'supports json request' do
|
||||
delete :leave, group_id: group, format: :json
|
||||
delete :leave, params: { group_id: group }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response['notice']).to eq "You left the \"#{group.name}\" group."
|
||||
|
|
@ -174,7 +180,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'cannot removes himself from the group' do
|
||||
delete :leave, group_id: group
|
||||
delete :leave, params: { group_id: group }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
|
@ -186,7 +192,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'removes user from members' do
|
||||
delete :leave, group_id: group
|
||||
delete :leave, params: { group_id: group }
|
||||
|
||||
expect(response).to set_flash.to 'Your access request to the group has been withdrawn.'
|
||||
expect(response).to redirect_to(group_path(group))
|
||||
|
|
@ -203,7 +209,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'creates a new GroupMember that is not a team member' do
|
||||
post :request_access, group_id: group
|
||||
post :request_access, params: { group_id: group }
|
||||
|
||||
expect(response).to set_flash.to 'Your request for access has been queued for review.'
|
||||
expect(response).to redirect_to(group_path(group))
|
||||
|
|
@ -221,7 +227,7 @@ describe Groups::GroupMembersController do
|
|||
|
||||
context 'when member is not found' do
|
||||
it 'returns 403' do
|
||||
post :approve_access_request, group_id: group, id: 42
|
||||
post :approve_access_request, params: { group_id: group, id: 42 }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
|
@ -234,7 +240,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'returns 403' do
|
||||
post :approve_access_request, group_id: group, id: member
|
||||
post :approve_access_request, params: { group_id: group, id: member }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
expect(group.members).not_to include member
|
||||
|
|
@ -247,7 +253,7 @@ describe Groups::GroupMembersController do
|
|||
end
|
||||
|
||||
it 'adds user to members' do
|
||||
post :approve_access_request, group_id: group, id: member
|
||||
post :approve_access_request, params: { group_id: group, id: member }
|
||||
|
||||
expect(response).to redirect_to(group_group_members_path(group))
|
||||
expect(group.members).to include member
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe Groups::LabelsController do
|
|||
set(:group_label_1) { create(:group_label, group: group, title: 'group_label_1') }
|
||||
|
||||
it 'returns group and project labels by default' do
|
||||
get :index, group_id: group, format: :json
|
||||
get :index, params: { group_id: group }, format: :json
|
||||
|
||||
label_ids = json_response.map {|label| label['title']}
|
||||
expect(label_ids).to match_array([label_1.title, group_label_1.title])
|
||||
|
|
@ -31,7 +31,7 @@ describe Groups::LabelsController do
|
|||
end
|
||||
|
||||
it 'returns ancestor group labels', :nested_groups do
|
||||
get :index, group_id: subgroup, include_ancestor_groups: true, only_group_labels: true, format: :json
|
||||
get :index, params: { group_id: subgroup, include_ancestor_groups: true, only_group_labels: true }, format: :json
|
||||
|
||||
label_ids = json_response.map {|label| label['title']}
|
||||
expect(label_ids).to match_array([group_label_1.title, subgroup_label_1.title])
|
||||
|
|
@ -43,7 +43,7 @@ describe Groups::LabelsController do
|
|||
it 'allows user to toggle subscription on group labels' do
|
||||
label = create(:group_label, group: group)
|
||||
|
||||
post :toggle_subscription, group_id: group.to_param, id: label.to_param
|
||||
post :toggle_subscription, params: { group_id: group.to_param, id: label.to_param }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ describe Groups::MilestonesController do
|
|||
|
||||
describe '#index' do
|
||||
it 'shows group milestones page' do
|
||||
get :index, group_id: group.to_param
|
||||
get :index, params: { group_id: group.to_param }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -44,7 +44,7 @@ describe Groups::MilestonesController do
|
|||
let!(:legacy_milestone2) { create(:milestone, project: project2, title: 'legacy') }
|
||||
|
||||
it 'lists legacy group milestones and group milestones' do
|
||||
get :index, group_id: group.to_param, format: :json
|
||||
get :index, params: { group_id: group.to_param }, format: :json
|
||||
|
||||
milestones = JSON.parse(response.body)
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ describe Groups::MilestonesController do
|
|||
expect(GlobalMilestone).to receive(:build)
|
||||
expect(Milestone).not_to receive(:find_by_iid)
|
||||
|
||||
get :show, group_id: group.to_param, id: title, title: milestone1.safe_title
|
||||
get :show, params: { group_id: group.to_param, id: title, title: milestone1.safe_title }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ describe Groups::MilestonesController do
|
|||
expect(GlobalMilestone).not_to receive(:build)
|
||||
expect(Milestone).to receive(:find_by_iid)
|
||||
|
||||
get :show, group_id: group.to_param, id: group_milestone.id
|
||||
get :show, params: { group_id: group.to_param, id: group_milestone.id }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -86,8 +86,10 @@ describe Groups::MilestonesController do
|
|||
describe "#create" do
|
||||
it "creates group milestone with Chinese title" do
|
||||
post :create,
|
||||
group_id: group.to_param,
|
||||
milestone: milestone_params
|
||||
params: {
|
||||
group_id: group.to_param,
|
||||
milestone: milestone_params
|
||||
}
|
||||
|
||||
milestone = Milestone.find_by_title(title)
|
||||
|
||||
|
|
@ -105,9 +107,11 @@ describe Groups::MilestonesController do
|
|||
milestone_params[:title] = "title changed"
|
||||
|
||||
put :update,
|
||||
id: milestone.iid,
|
||||
group_id: group.to_param,
|
||||
milestone: milestone_params
|
||||
params: {
|
||||
id: milestone.iid,
|
||||
group_id: group.to_param,
|
||||
milestone: milestone_params
|
||||
}
|
||||
|
||||
milestone.reload
|
||||
expect(response).to redirect_to(group_milestone_path(group, milestone.iid))
|
||||
|
|
@ -124,10 +128,12 @@ describe Groups::MilestonesController do
|
|||
milestone_params[:state_event] = "close"
|
||||
|
||||
put :update,
|
||||
id: milestone1.title.to_slug.to_s,
|
||||
group_id: group.to_param,
|
||||
milestone: milestone_params,
|
||||
title: milestone1.title
|
||||
params: {
|
||||
id: milestone1.title.to_slug.to_s,
|
||||
group_id: group.to_param,
|
||||
milestone: milestone_params,
|
||||
title: milestone1.title
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(group_milestone_path(group, milestone1.safe_title, title: milestone1.title))
|
||||
|
||||
|
|
@ -145,7 +151,7 @@ describe Groups::MilestonesController do
|
|||
let(:milestone) { create(:milestone, group: group) }
|
||||
|
||||
it "removes milestone" do
|
||||
delete :destroy, group_id: group.to_param, id: milestone.iid, format: :js
|
||||
delete :destroy, params: { group_id: group.to_param, id: milestone.iid }, format: :js
|
||||
|
||||
expect(response).to be_success
|
||||
expect { Milestone.find(milestone.id) }.to raise_exception(ActiveRecord::RecordNotFound)
|
||||
|
|
@ -162,7 +168,7 @@ describe Groups::MilestonesController do
|
|||
context 'non-show path' do
|
||||
context 'with exactly matching casing' do
|
||||
it 'does not redirect' do
|
||||
get :index, group_id: group.to_param
|
||||
get :index, params: { group_id: group.to_param }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -170,7 +176,7 @@ describe Groups::MilestonesController do
|
|||
|
||||
context 'with different casing' do
|
||||
it 'redirects to the correct casing' do
|
||||
get :index, group_id: group.to_param.upcase
|
||||
get :index, params: { group_id: group.to_param.upcase }
|
||||
|
||||
expect(response).to redirect_to(group_milestones_path(group.to_param))
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
|
|
@ -181,7 +187,7 @@ describe Groups::MilestonesController do
|
|||
context 'show path' do
|
||||
context 'with exactly matching casing' do
|
||||
it 'does not redirect' do
|
||||
get :show, group_id: group.to_param, id: title
|
||||
get :show, params: { group_id: group.to_param, id: title }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -189,7 +195,7 @@ describe Groups::MilestonesController do
|
|||
|
||||
context 'with different casing' do
|
||||
it 'redirects to the correct casing' do
|
||||
get :show, group_id: group.to_param.upcase, id: title
|
||||
get :show, params: { group_id: group.to_param.upcase, id: title }
|
||||
|
||||
expect(response).to redirect_to(group_milestone_path(group.to_param, title))
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
|
|
@ -202,7 +208,7 @@ describe Groups::MilestonesController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
|
||||
|
||||
it 'redirects to the canonical path' do
|
||||
get :merge_requests, group_id: redirect_route.path, id: title
|
||||
get :merge_requests, params: { group_id: redirect_route.path, id: title }
|
||||
|
||||
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -212,7 +218,7 @@ describe Groups::MilestonesController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
|
||||
|
||||
it 'does not modify the requested host' do
|
||||
get :merge_requests, group_id: redirect_route.path, id: title
|
||||
get :merge_requests, params: { group_id: redirect_route.path, id: title }
|
||||
|
||||
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -224,7 +230,7 @@ describe Groups::MilestonesController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
|
||||
|
||||
it 'does not modify the /groups part of the path' do
|
||||
get :merge_requests, group_id: redirect_route.path, id: title
|
||||
get :merge_requests, params: { group_id: redirect_route.path, id: title }
|
||||
|
||||
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -236,7 +242,7 @@ describe Groups::MilestonesController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
|
||||
|
||||
it 'does not modify the /groups part of the path' do
|
||||
get :merge_requests, group_id: redirect_route.path, id: title
|
||||
get :merge_requests, params: { group_id: redirect_route.path, id: title }
|
||||
|
||||
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -250,16 +256,20 @@ describe Groups::MilestonesController do
|
|||
context 'when requesting the canonical path with different casing' do
|
||||
it 'does not 404' do
|
||||
post :create,
|
||||
group_id: group.to_param,
|
||||
milestone: { title: title }
|
||||
params: {
|
||||
group_id: group.to_param,
|
||||
milestone: { title: title }
|
||||
}
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'does not redirect to the correct casing' do
|
||||
post :create,
|
||||
group_id: group.to_param,
|
||||
milestone: { title: title }
|
||||
params: {
|
||||
group_id: group.to_param,
|
||||
milestone: { title: title }
|
||||
}
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -270,8 +280,10 @@ describe Groups::MilestonesController do
|
|||
|
||||
it 'returns not found' do
|
||||
post :create,
|
||||
group_id: redirect_route.path,
|
||||
milestone: { title: title }
|
||||
params: {
|
||||
group_id: redirect_route.path,
|
||||
milestone: { title: title }
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe Groups::RunnersController do
|
|||
new_desc = runner.description.swapcase
|
||||
|
||||
expect do
|
||||
post :update, params.merge(runner: { description: new_desc } )
|
||||
post :update, params: params.merge(runner: { description: new_desc } )
|
||||
end.to change { runner.ensure_runner_queue_value }
|
||||
|
||||
runner.reload
|
||||
|
|
@ -34,7 +34,7 @@ describe Groups::RunnersController do
|
|||
|
||||
describe '#destroy' do
|
||||
it 'destroys the runner' do
|
||||
delete :destroy, params
|
||||
delete :destroy, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(Ci::Runner.find_by(id: runner.id)).to be_nil
|
||||
|
|
@ -46,7 +46,7 @@ describe Groups::RunnersController do
|
|||
runner.update(active: false)
|
||||
|
||||
expect do
|
||||
post :resume, params
|
||||
post :resume, params: params
|
||||
end.to change { runner.ensure_runner_queue_value }
|
||||
|
||||
runner.reload
|
||||
|
|
@ -61,7 +61,7 @@ describe Groups::RunnersController do
|
|||
runner.update(active: true)
|
||||
|
||||
expect do
|
||||
post :pause, params
|
||||
post :pause, params: params
|
||||
end.to change { runner.ensure_runner_queue_value }
|
||||
|
||||
runner.reload
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Groups::Settings::CiCdController do
|
|||
|
||||
describe 'GET #show' do
|
||||
it 'renders show with 200 status code' do
|
||||
get :show, group_id: group
|
||||
get :show, params: { group_id: group }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template(:show)
|
||||
|
|
@ -19,7 +19,7 @@ describe Groups::Settings::CiCdController do
|
|||
end
|
||||
|
||||
describe 'PUT #reset_registration_token' do
|
||||
subject { put :reset_registration_token, group_id: group }
|
||||
subject { put :reset_registration_token, params: { group_id: group } }
|
||||
|
||||
it 'resets runner registration token' do
|
||||
expect { subject }.to change { group.reload.runners_token }
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
describe Groups::SharedProjectsController do
|
||||
def get_shared_projects(params = {})
|
||||
get :index, params.reverse_merge(format: :json, group_id: group.full_path)
|
||||
get :index, params: params.reverse_merge(format: :json, group_id: group.full_path)
|
||||
end
|
||||
|
||||
def share_project(project)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ describe Groups::UploadsController do
|
|||
def post_authorize(verified: true)
|
||||
request.headers.merge!(workhorse_internal_api_request_header) if verified
|
||||
|
||||
post :authorize, group_id: model.full_path, format: :json
|
||||
post :authorize, params: { group_id: model.full_path }, format: :json
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe Groups::VariablesController do
|
|||
let!(:variable) { create(:ci_group_variable, group: group) }
|
||||
|
||||
subject do
|
||||
get :show, group_id: group, format: :json
|
||||
get :show, params: { group_id: group }, format: :json
|
||||
end
|
||||
|
||||
include_examples 'GET #show lists all variables'
|
||||
|
|
@ -25,8 +25,10 @@ describe Groups::VariablesController do
|
|||
|
||||
subject do
|
||||
patch :update,
|
||||
group_id: group,
|
||||
variables_attributes: variables_attributes,
|
||||
params: {
|
||||
group_id: group,
|
||||
variables_attributes: variables_attributes
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ describe GroupsController do
|
|||
it 'renders the new page' do
|
||||
sign_in(member)
|
||||
|
||||
get :new, parent_id: group.id
|
||||
get :new, params: { parent_id: group.id }
|
||||
|
||||
expect(response).to render_template(:new)
|
||||
end
|
||||
|
|
@ -25,7 +25,7 @@ describe GroupsController do
|
|||
it 'renders the 404 page' do
|
||||
sign_in(member)
|
||||
|
||||
get :new, parent_id: group.id
|
||||
get :new, params: { parent_id: group.id }
|
||||
|
||||
expect(response).not_to render_template(:new)
|
||||
expect(response.status).to eq(404)
|
||||
|
|
@ -42,7 +42,7 @@ describe GroupsController do
|
|||
it 'assigns events for all the projects in the group' do
|
||||
create(:event, project: project)
|
||||
|
||||
get :show, id: group.to_param, format: :atom
|
||||
get :show, params: { id: group.to_param }, format: :atom
|
||||
|
||||
expect(assigns(:events)).not_to be_empty
|
||||
end
|
||||
|
|
@ -53,7 +53,7 @@ describe GroupsController do
|
|||
it 'sets the badge API endpoint' do
|
||||
sign_in(owner)
|
||||
|
||||
get :edit, id: group.to_param
|
||||
get :edit, params: { id: group.to_param }
|
||||
|
||||
expect(assigns(:badge_api_endpoint)).not_to be_nil
|
||||
end
|
||||
|
|
@ -102,7 +102,7 @@ describe GroupsController do
|
|||
create(:event, project: project)
|
||||
end
|
||||
|
||||
get :activity, id: group.to_param, format: :json
|
||||
get :activity, params: { id: group.to_param }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response['count']).to eq(3)
|
||||
|
|
@ -120,7 +120,7 @@ describe GroupsController do
|
|||
owner.update_attribute(:can_create_group, can_create_group_status)
|
||||
sign_in(owner)
|
||||
|
||||
post :create, group: { parent_id: group.id, path: 'subgroup' }
|
||||
post :create, params: { group: { parent_id: group.id, path: 'subgroup' } }
|
||||
|
||||
expect(response).to be_redirect
|
||||
expect(response.body).to match(%r{http://test.host/#{group.path}/subgroup})
|
||||
|
|
@ -134,7 +134,7 @@ describe GroupsController do
|
|||
|
||||
previous_group_count = Group.count
|
||||
|
||||
post :create, group: { parent_id: group.id, path: 'subgroup' }
|
||||
post :create, params: { group: { parent_id: group.id, path: 'subgroup' } }
|
||||
|
||||
expect(response).to render_template(:new)
|
||||
expect(Group.count).to eq(previous_group_count)
|
||||
|
|
@ -157,7 +157,7 @@ describe GroupsController do
|
|||
it 'creates the Group' do
|
||||
original_group_count = Group.count
|
||||
|
||||
post :create, group: { path: 'subgroup' }
|
||||
post :create, params: { group: { path: 'subgroup' } }
|
||||
|
||||
expect(Group.count).to eq(original_group_count + 1)
|
||||
expect(response).to be_redirect
|
||||
|
|
@ -172,7 +172,7 @@ describe GroupsController do
|
|||
it 'does not create the Group' do
|
||||
original_group_count = Group.count
|
||||
|
||||
post :create, group: { path: 'subgroup' }
|
||||
post :create, params: { group: { path: 'subgroup' } }
|
||||
|
||||
expect(Group.count).to eq(original_group_count)
|
||||
expect(response).to render_template(:new)
|
||||
|
|
@ -215,12 +215,12 @@ describe GroupsController do
|
|||
|
||||
context 'sorting by votes' do
|
||||
it 'sorts most popular issues' do
|
||||
get :issues, id: group.to_param, sort: 'upvotes_desc'
|
||||
get :issues, params: { id: group.to_param, sort: 'upvotes_desc' }
|
||||
expect(assigns(:issues)).to eq [issue_2, issue_1]
|
||||
end
|
||||
|
||||
it 'sorts least popular issues' do
|
||||
get :issues, id: group.to_param, sort: 'downvotes_desc'
|
||||
get :issues, params: { id: group.to_param, sort: 'downvotes_desc' }
|
||||
expect(assigns(:issues)).to eq [issue_2, issue_1]
|
||||
end
|
||||
end
|
||||
|
|
@ -233,19 +233,19 @@ describe GroupsController do
|
|||
end
|
||||
|
||||
it 'works with popularity sort' do
|
||||
get :issues, id: group.to_param, search: 'foo', sort: 'popularity'
|
||||
get :issues, params: { id: group.to_param, search: 'foo', sort: 'popularity' }
|
||||
|
||||
expect(assigns(:issues)).to eq([issue_1])
|
||||
end
|
||||
|
||||
it 'works with priority sort' do
|
||||
get :issues, id: group.to_param, search: 'foo', sort: 'priority'
|
||||
get :issues, params: { id: group.to_param, search: 'foo', sort: 'priority' }
|
||||
|
||||
expect(assigns(:issues)).to eq([issue_1])
|
||||
end
|
||||
|
||||
it 'works with label priority sort' do
|
||||
get :issues, id: group.to_param, search: 'foo', sort: 'label_priority'
|
||||
get :issues, params: { id: group.to_param, search: 'foo', sort: 'label_priority' }
|
||||
|
||||
expect(assigns(:issues)).to eq([issue_1])
|
||||
end
|
||||
|
|
@ -266,12 +266,12 @@ describe GroupsController do
|
|||
|
||||
context 'sorting by votes' do
|
||||
it 'sorts most popular merge requests' do
|
||||
get :merge_requests, id: group.to_param, sort: 'upvotes_desc'
|
||||
get :merge_requests, params: { id: group.to_param, sort: 'upvotes_desc' }
|
||||
expect(assigns(:merge_requests)).to eq [merge_request_2, merge_request_1]
|
||||
end
|
||||
|
||||
it 'sorts least popular merge requests' do
|
||||
get :merge_requests, id: group.to_param, sort: 'downvotes_desc'
|
||||
get :merge_requests, params: { id: group.to_param, sort: 'downvotes_desc' }
|
||||
expect(assigns(:merge_requests)).to eq [merge_request_2, merge_request_1]
|
||||
end
|
||||
end
|
||||
|
|
@ -282,7 +282,7 @@ describe GroupsController do
|
|||
it 'returns 404' do
|
||||
sign_in(create(:user))
|
||||
|
||||
delete :destroy, id: group.to_param
|
||||
delete :destroy, params: { id: group.to_param }
|
||||
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
|
@ -295,12 +295,12 @@ describe GroupsController do
|
|||
|
||||
it 'schedules a group destroy' do
|
||||
Sidekiq::Testing.fake! do
|
||||
expect { delete :destroy, id: group.to_param }.to change(GroupDestroyWorker.jobs, :size).by(1)
|
||||
expect { delete :destroy, params: { id: group.to_param } }.to change(GroupDestroyWorker.jobs, :size).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
it 'redirects to the root path' do
|
||||
delete :destroy, id: group.to_param
|
||||
delete :destroy, params: { id: group.to_param }
|
||||
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
|
|
@ -313,7 +313,7 @@ describe GroupsController do
|
|||
end
|
||||
|
||||
it 'updates the path successfully' do
|
||||
post :update, id: group.to_param, group: { path: 'new_path' }
|
||||
post :update, params: { id: group.to_param, group: { path: 'new_path' } }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(controller).to set_flash[:notice]
|
||||
|
|
@ -321,7 +321,7 @@ describe GroupsController do
|
|||
|
||||
it 'does not update the path on error' do
|
||||
allow_any_instance_of(Group).to receive(:move_dir).and_raise(Gitlab::UpdatePathError)
|
||||
post :update, id: group.to_param, group: { path: 'new_path' }
|
||||
post :update, params: { id: group.to_param, group: { path: 'new_path' } }
|
||||
|
||||
expect(assigns(:group).errors).not_to be_empty
|
||||
expect(assigns(:group).path).not_to eq('new_path')
|
||||
|
|
@ -337,7 +337,7 @@ describe GroupsController do
|
|||
context 'when requesting groups at the root path' do
|
||||
before do
|
||||
allow(request).to receive(:original_fullpath).and_return("/#{group_full_path}")
|
||||
get :show, id: group_full_path
|
||||
get :show, params: { id: group_full_path }
|
||||
end
|
||||
|
||||
context 'when requesting the canonical path with different casing' do
|
||||
|
|
@ -384,7 +384,7 @@ describe GroupsController do
|
|||
context 'non-show path' do
|
||||
context 'with exactly matching casing' do
|
||||
it 'does not redirect' do
|
||||
get :issues, id: group.to_param
|
||||
get :issues, params: { id: group.to_param }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -392,7 +392,7 @@ describe GroupsController do
|
|||
|
||||
context 'with different casing' do
|
||||
it 'redirects to the correct casing' do
|
||||
get :issues, id: group.to_param.upcase
|
||||
get :issues, params: { id: group.to_param.upcase }
|
||||
|
||||
expect(response).to redirect_to(issues_group_path(group.to_param))
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
|
|
@ -403,7 +403,7 @@ describe GroupsController do
|
|||
context 'show path' do
|
||||
context 'with exactly matching casing' do
|
||||
it 'does not redirect' do
|
||||
get :show, id: group.to_param
|
||||
get :show, params: { id: group.to_param }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -411,7 +411,7 @@ describe GroupsController do
|
|||
|
||||
context 'with different casing' do
|
||||
it 'redirects to the correct casing at the root path' do
|
||||
get :show, id: group.to_param.upcase
|
||||
get :show, params: { id: group.to_param.upcase }
|
||||
|
||||
expect(response).to redirect_to(group)
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
|
|
@ -424,7 +424,7 @@ describe GroupsController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
|
||||
|
||||
it 'redirects to the canonical path' do
|
||||
get :issues, id: redirect_route.path
|
||||
get :issues, params: { id: redirect_route.path }
|
||||
|
||||
expect(response).to redirect_to(issues_group_path(group.to_param))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -434,7 +434,7 @@ describe GroupsController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
|
||||
|
||||
it 'does not modify the requested host' do
|
||||
get :issues, id: redirect_route.path
|
||||
get :issues, params: { id: redirect_route.path }
|
||||
|
||||
expect(response).to redirect_to(issues_group_path(group.to_param))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -446,7 +446,7 @@ describe GroupsController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'oups') }
|
||||
|
||||
it 'does not modify the /groups part of the path' do
|
||||
get :issues, id: redirect_route.path
|
||||
get :issues, params: { id: redirect_route.path }
|
||||
|
||||
expect(response).to redirect_to(issues_group_path(group.to_param))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -458,7 +458,7 @@ describe GroupsController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'oups/oup') }
|
||||
|
||||
it 'does not modify the /groups part of the path' do
|
||||
get :issues, id: redirect_route.path
|
||||
get :issues, params: { id: redirect_route.path }
|
||||
|
||||
expect(response).to redirect_to(issues_group_path(group.to_param))
|
||||
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
|
||||
|
|
@ -470,13 +470,13 @@ describe GroupsController do
|
|||
context 'for a POST request' do
|
||||
context 'when requesting the canonical path with different casing' do
|
||||
it 'does not 404' do
|
||||
post :update, id: group.to_param.upcase, group: { path: 'new_path' }
|
||||
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'does not redirect to the correct casing' do
|
||||
post :update, id: group.to_param.upcase, group: { path: 'new_path' }
|
||||
post :update, params: { id: group.to_param.upcase, group: { path: 'new_path' } }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -486,7 +486,7 @@ describe GroupsController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
|
||||
|
||||
it 'returns not found' do
|
||||
post :update, id: redirect_route.path, group: { path: 'new_path' }
|
||||
post :update, params: { id: redirect_route.path, group: { path: 'new_path' } }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -496,13 +496,13 @@ describe GroupsController do
|
|||
context 'for a DELETE request' do
|
||||
context 'when requesting the canonical path with different casing' do
|
||||
it 'does not 404' do
|
||||
delete :destroy, id: group.to_param.upcase
|
||||
delete :destroy, params: { id: group.to_param.upcase }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'does not redirect to the correct casing' do
|
||||
delete :destroy, id: group.to_param.upcase
|
||||
delete :destroy, params: { id: group.to_param.upcase }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -512,7 +512,7 @@ describe GroupsController do
|
|||
let(:redirect_route) { group.redirect_routes.create(path: 'old-path') }
|
||||
|
||||
it 'returns not found' do
|
||||
delete :destroy, id: redirect_route.path
|
||||
delete :destroy, params: { id: redirect_route.path }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -537,8 +537,10 @@ describe GroupsController do
|
|||
|
||||
before do
|
||||
put :transfer,
|
||||
id: group.to_param,
|
||||
new_parent_group_id: new_parent_group.id
|
||||
params: {
|
||||
id: group.to_param,
|
||||
new_parent_group_id: new_parent_group.id
|
||||
}
|
||||
end
|
||||
|
||||
it 'should return a notice' do
|
||||
|
|
@ -556,8 +558,10 @@ describe GroupsController do
|
|||
|
||||
before do
|
||||
put :transfer,
|
||||
id: group.to_param,
|
||||
new_parent_group_id: ''
|
||||
params: {
|
||||
id: group.to_param,
|
||||
new_parent_group_id: ''
|
||||
}
|
||||
end
|
||||
|
||||
it 'should return a notice' do
|
||||
|
|
@ -578,8 +582,10 @@ describe GroupsController do
|
|||
allow_any_instance_of(::Groups::TransferService).to receive(:proceed_to_transfer).and_raise(Gitlab::UpdatePathError, 'namespace directory cannot be moved')
|
||||
|
||||
put :transfer,
|
||||
id: group.to_param,
|
||||
new_parent_group_id: new_parent_group.id
|
||||
params: {
|
||||
id: group.to_param,
|
||||
new_parent_group_id: new_parent_group.id
|
||||
}
|
||||
end
|
||||
|
||||
it 'should return an alert' do
|
||||
|
|
@ -598,8 +604,10 @@ describe GroupsController do
|
|||
|
||||
before do
|
||||
put :transfer,
|
||||
id: group.to_param,
|
||||
new_parent_group_id: new_parent_group.id
|
||||
params: {
|
||||
id: group.to_param,
|
||||
new_parent_group_id: new_parent_group.id
|
||||
}
|
||||
end
|
||||
|
||||
it 'should be denied' do
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ describe HealthCheckController do
|
|||
end
|
||||
|
||||
it 'supports passing the token in query params' do
|
||||
get :index, token: token
|
||||
get :index, params: { token: token }
|
||||
|
||||
expect(response).to be_success
|
||||
expect(response.content_type).to eq 'text/plain'
|
||||
|
|
@ -74,7 +74,7 @@ describe HealthCheckController do
|
|||
end
|
||||
|
||||
it 'supports successful responses for specific checks' do
|
||||
get :index, checks: 'email', format: :json
|
||||
get :index, params: { checks: 'email' }, format: :json
|
||||
|
||||
expect(response).to be_success
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
|
|
@ -124,7 +124,7 @@ describe HealthCheckController do
|
|||
end
|
||||
|
||||
it 'supports failure responses for specific checks' do
|
||||
get :index, checks: 'email', format: :json
|
||||
get :index, params: { checks: 'email' }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(500)
|
||||
expect(response.content_type).to eq 'application/json'
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe HealthController do
|
|||
shared_context 'endpoint responding with readiness data' do
|
||||
let(:request_params) { {} }
|
||||
|
||||
subject { get :readiness, request_params }
|
||||
subject { get :readiness, params: request_params }
|
||||
|
||||
it 'responds with readiness checks data' do
|
||||
subject
|
||||
|
|
@ -112,7 +112,7 @@ describe HealthController do
|
|||
|
||||
context 'token passed as URL param' do
|
||||
it_behaves_like 'endpoint responding with liveness data' do
|
||||
subject { get :liveness, token: token }
|
||||
subject { get :liveness, params: { token: token } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ describe HelpController do
|
|||
context 'for Markdown formats' do
|
||||
context 'when requested file exists' do
|
||||
before do
|
||||
get :show, path: 'ssh/README', format: :md
|
||||
get :show, params: { path: 'ssh/README' }, format: :md
|
||||
end
|
||||
|
||||
it 'assigns to @markdown' do
|
||||
|
|
@ -58,7 +58,7 @@ describe HelpController do
|
|||
|
||||
context 'when requested file is missing' do
|
||||
it 'renders not found' do
|
||||
get :show, path: 'foo/bar', format: :md
|
||||
get :show, params: { path: 'foo/bar' }, format: :md
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
end
|
||||
|
|
@ -68,7 +68,9 @@ describe HelpController do
|
|||
context 'when requested file exists' do
|
||||
it 'renders the raw file' do
|
||||
get :show,
|
||||
path: 'user/project/img/labels_default',
|
||||
params: {
|
||||
path: 'user/project/img/labels_default'
|
||||
},
|
||||
format: :png
|
||||
expect(response).to be_success
|
||||
expect(response.content_type).to eq 'image/png'
|
||||
|
|
@ -79,7 +81,9 @@ describe HelpController do
|
|||
context 'when requested file is missing' do
|
||||
it 'renders not found' do
|
||||
get :show,
|
||||
path: 'foo/bar',
|
||||
params: {
|
||||
path: 'foo/bar'
|
||||
},
|
||||
format: :png
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -89,7 +93,9 @@ describe HelpController do
|
|||
context 'for other formats' do
|
||||
it 'always renders not found' do
|
||||
get :show,
|
||||
path: 'ssh/README',
|
||||
params: {
|
||||
path: 'ssh/README'
|
||||
},
|
||||
format: :foo
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ describe Import::BitbucketController do
|
|||
.to receive(:new).with(bitbucket_repo, test_name, nested_namespace, user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :json }
|
||||
post :create, params: { target_namespace: nested_namespace.full_path, new_name: test_name }, format: :json
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ describe Import::BitbucketController do
|
|||
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json }
|
||||
post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json
|
||||
end
|
||||
|
||||
it 'creates the namespaces' do
|
||||
|
|
@ -257,7 +257,7 @@ describe Import::BitbucketController do
|
|||
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
expect { post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json } }
|
||||
expect { post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json }
|
||||
.to change { Namespace.count }.by(2)
|
||||
end
|
||||
|
||||
|
|
@ -266,7 +266,7 @@ describe Import::BitbucketController do
|
|||
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: 'foo/bar', new_name: test_name, format: :json }
|
||||
post :create, params: { target_namespace: 'foo/bar', new_name: test_name }, format: :json
|
||||
|
||||
expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo')
|
||||
end
|
||||
|
|
@ -285,7 +285,7 @@ describe Import::BitbucketController do
|
|||
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json }
|
||||
post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :json
|
||||
end
|
||||
|
||||
it 'creates the namespaces' do
|
||||
|
|
@ -293,7 +293,7 @@ describe Import::BitbucketController do
|
|||
.to receive(:new).with(bitbucket_repo, test_name, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
expect { post :create, { target_namespace: 'foo/foobar/bar', new_name: test_name, format: :json } }
|
||||
expect { post :create, params: { target_namespace: 'foo/foobar/bar', new_name: test_name }, format: :json }
|
||||
.to change { Namespace.count }.by(2)
|
||||
end
|
||||
end
|
||||
|
|
@ -302,7 +302,7 @@ describe Import::BitbucketController do
|
|||
it 'returns 422 response' do
|
||||
other_namespace = create(:group, name: 'other_namespace')
|
||||
|
||||
post :create, { target_namespace: other_namespace.name, format: :json }
|
||||
post :create, params: { target_namespace: other_namespace.name }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -42,19 +42,19 @@ describe Import::BitbucketServerController do
|
|||
.to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, project: project_key, repository: repo_slug, format: :json
|
||||
post :create, params: { project: project_key, repository: repo_slug }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it 'returns an error when an invalid project key is used' do
|
||||
post :create, project: 'some&project'
|
||||
post :create, params: { project: 'some&project' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
||||
it 'returns an error when an invalid repository slug is used' do
|
||||
post :create, project: 'some-project', repository: 'try*this'
|
||||
post :create, params: { project: 'some-project', repository: 'try*this' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
|
@ -62,7 +62,7 @@ describe Import::BitbucketServerController do
|
|||
it 'returns an error when the project cannot be found' do
|
||||
allow(client).to receive(:repo).with(project_key, repo_slug).and_return(nil)
|
||||
|
||||
post :create, project: project_key, repository: repo_slug, format: :json
|
||||
post :create, params: { project: project_key, repository: repo_slug }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
|
@ -72,7 +72,7 @@ describe Import::BitbucketServerController do
|
|||
.to receive(:new).with(project_key, repo_slug, anything, 'my-project', user.namespace, user, anything)
|
||||
.and_return(double(execute: build(:project)))
|
||||
|
||||
post :create, project: project_key, repository: repo_slug, format: :json
|
||||
post :create, params: { project: project_key, repository: repo_slug }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
|
@ -80,7 +80,7 @@ describe Import::BitbucketServerController do
|
|||
it "returns an error when the server can't be contacted" do
|
||||
expect(client).to receive(:repo).with(project_key, repo_slug).and_raise(BitbucketServer::Client::ServerError)
|
||||
|
||||
post :create, project: project_key, repository: repo_slug, format: :json
|
||||
post :create, params: { project: project_key, repository: repo_slug }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
|
@ -103,7 +103,7 @@ describe Import::BitbucketServerController do
|
|||
end
|
||||
|
||||
it 'sets the session variables' do
|
||||
post :configure, personal_access_token: token, bitbucket_username: username, bitbucket_server_url: url
|
||||
post :configure, params: { personal_access_token: token, bitbucket_username: username, bitbucket_server_url: url }
|
||||
|
||||
expect(session[:bitbucket_server_url]).to eq(url)
|
||||
expect(session[:bitbucket_server_username]).to eq(username)
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ describe Import::GitlabController do
|
|||
.to receive(:new).with(gitlab_repo, nested_namespace, user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: nested_namespace.full_path, format: :json }
|
||||
post :create, params: { target_namespace: nested_namespace.full_path }, format: :json
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ describe Import::GitlabController do
|
|||
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: 'foo/bar', format: :json }
|
||||
post :create, params: { target_namespace: 'foo/bar' }, format: :json
|
||||
end
|
||||
|
||||
it 'creates the namespaces' do
|
||||
|
|
@ -229,7 +229,7 @@ describe Import::GitlabController do
|
|||
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
expect { post :create, { target_namespace: 'foo/bar', format: :json } }
|
||||
expect { post :create, params: { target_namespace: 'foo/bar' }, format: :json }
|
||||
.to change { Namespace.count }.by(2)
|
||||
end
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ describe Import::GitlabController do
|
|||
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: 'foo/bar', format: :json }
|
||||
post :create, params: { target_namespace: 'foo/bar' }, format: :json
|
||||
|
||||
expect(Namespace.find_by_path_or_name('bar').parent.path).to eq('foo')
|
||||
end
|
||||
|
|
@ -257,7 +257,7 @@ describe Import::GitlabController do
|
|||
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
post :create, { target_namespace: 'foo/foobar/bar', format: :json }
|
||||
post :create, params: { target_namespace: 'foo/foobar/bar' }, format: :json
|
||||
end
|
||||
|
||||
it 'creates the namespaces' do
|
||||
|
|
@ -265,7 +265,7 @@ describe Import::GitlabController do
|
|||
.to receive(:new).with(gitlab_repo, kind_of(Namespace), user, access_params)
|
||||
.and_return(double(execute: project))
|
||||
|
||||
expect { post :create, { target_namespace: 'foo/foobar/bar', format: :json } }
|
||||
expect { post :create, params: { target_namespace: 'foo/foobar/bar' }, format: :json }
|
||||
.to change { Namespace.count }.by(2)
|
||||
end
|
||||
end
|
||||
|
|
@ -274,7 +274,7 @@ describe Import::GitlabController do
|
|||
it 'returns 422 response' do
|
||||
other_namespace = create(:group, name: 'other_namespace')
|
||||
|
||||
post :create, { target_namespace: other_namespace.name, format: :json }
|
||||
post :create, params: { target_namespace: other_namespace.name }, format: :json
|
||||
|
||||
expect(response).to have_gitlab_http_status(422)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ describe Import::GitlabProjectsController do
|
|||
describe 'POST create' do
|
||||
context 'with an invalid path' do
|
||||
it 'redirects with an error' do
|
||||
post :create, namespace_id: namespace.id, path: '/test', file: file
|
||||
post :create, params: { namespace_id: namespace.id, path: '/test', file: file }
|
||||
|
||||
expect(flash[:alert]).to start_with('Project could not be imported')
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
||||
it 'redirects with an error when a relative path is used' do
|
||||
post :create, namespace_id: namespace.id, path: '../test', file: file
|
||||
post :create, params: { namespace_id: namespace.id, path: '../test', file: file }
|
||||
|
||||
expect(flash[:alert]).to start_with('Project could not be imported')
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -28,7 +28,7 @@ describe Import::GitlabProjectsController do
|
|||
|
||||
context 'with a valid path' do
|
||||
it 'redirects to the new project path' do
|
||||
post :create, namespace_id: namespace.id, path: 'test', file: file
|
||||
post :create, params: { namespace_id: namespace.id, path: 'test', file: file }
|
||||
|
||||
expect(flash[:notice]).to include('is being imported')
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe Import::GoogleCodeController do
|
|||
|
||||
describe "POST callback" do
|
||||
it "stores Google Takeout dump list in session" do
|
||||
post :callback, dump_file: dump_file
|
||||
post :callback, params: { dump_file: dump_file }
|
||||
|
||||
expect(session[:google_code_dump]).to be_a(Hash)
|
||||
expect(session[:google_code_dump]["kind"]).to eq("projecthosting#user")
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe InvitesController do
|
|||
|
||||
describe 'GET #accept' do
|
||||
it 'accepts user' do
|
||||
get :accept, id: token
|
||||
get :accept, params: { id: token }
|
||||
member.reload
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -23,7 +23,7 @@ describe InvitesController do
|
|||
|
||||
describe 'GET #decline' do
|
||||
it 'declines user' do
|
||||
get :decline, id: token
|
||||
get :decline, params: { id: token }
|
||||
expect {member.reload}.to raise_error ActiveRecord::RecordNotFound
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Ldap::OmniauthCallbacksController do
|
|||
|
||||
it 'respects remember me checkbox' do
|
||||
expect do
|
||||
post provider, remember_me: '1'
|
||||
post provider, params: { remember_me: '1' }
|
||||
end.to change { user.reload.remember_created_at }.from(nil)
|
||||
end
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ describe Ldap::OmniauthCallbacksController do
|
|||
let(:user) { create(:omniauth_user, :two_factor_via_otp, extern_uid: uid, provider: provider) }
|
||||
|
||||
it 'passes remember_me to the Devise view' do
|
||||
post provider, remember_me: '1'
|
||||
post provider, params: { remember_me: '1' }
|
||||
|
||||
expect(assigns[:user].remember_me).to eq '1'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ describe NotificationSettingsController do
|
|||
context 'when not authorized' do
|
||||
it 'redirects to sign in page' do
|
||||
post :create,
|
||||
project_id: project.id,
|
||||
notification_setting: { level: :participating }
|
||||
params: {
|
||||
project_id: project.id,
|
||||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
|
|
@ -41,8 +43,10 @@ describe NotificationSettingsController do
|
|||
|
||||
it 'creates notification setting' do
|
||||
post :create,
|
||||
project_id: project.id,
|
||||
notification_setting: { level: :participating }
|
||||
params: {
|
||||
project_id: project.id,
|
||||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(notification_setting.level).to eq("participating")
|
||||
|
|
@ -54,8 +58,10 @@ describe NotificationSettingsController do
|
|||
context 'with custom settings' do
|
||||
it 'creates notification setting' do
|
||||
post :create,
|
||||
project_id: project.id,
|
||||
notification_setting: { level: :custom }.merge(custom_events)
|
||||
params: {
|
||||
project_id: project.id,
|
||||
notification_setting: { level: :custom }.merge(custom_events)
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(notification_setting.level).to eq("custom")
|
||||
|
|
@ -72,8 +78,10 @@ describe NotificationSettingsController do
|
|||
|
||||
it 'creates notification setting' do
|
||||
post :create,
|
||||
namespace_id: group.id,
|
||||
notification_setting: { level: :watch }
|
||||
params: {
|
||||
namespace_id: group.id,
|
||||
notification_setting: { level: :watch }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(notification_setting.level).to eq("watch")
|
||||
|
|
@ -85,8 +93,10 @@ describe NotificationSettingsController do
|
|||
context 'with custom settings' do
|
||||
it 'creates notification setting' do
|
||||
post :create,
|
||||
namespace_id: group.id,
|
||||
notification_setting: { level: :custom }.merge(custom_events)
|
||||
params: {
|
||||
namespace_id: group.id,
|
||||
notification_setting: { level: :custom }.merge(custom_events)
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(notification_setting.level).to eq("custom")
|
||||
|
|
@ -108,8 +118,10 @@ describe NotificationSettingsController do
|
|||
|
||||
it 'returns 404' do
|
||||
post :create,
|
||||
project_id: private_project.id,
|
||||
notification_setting: { level: :participating }
|
||||
params: {
|
||||
project_id: private_project.id,
|
||||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -122,8 +134,10 @@ describe NotificationSettingsController do
|
|||
context 'when not authorized' do
|
||||
it 'redirects to sign in page' do
|
||||
put :update,
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating }
|
||||
params: {
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
|
|
@ -136,8 +150,10 @@ describe NotificationSettingsController do
|
|||
|
||||
it 'returns success' do
|
||||
put :update,
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating }
|
||||
params: {
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
|
@ -153,8 +169,10 @@ describe NotificationSettingsController do
|
|||
|
||||
it 'returns success' do
|
||||
put :update,
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating, events: custom_events }
|
||||
params: {
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating, events: custom_events }
|
||||
}
|
||||
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
|
@ -170,8 +188,10 @@ describe NotificationSettingsController do
|
|||
|
||||
it 'returns 404' do
|
||||
put :update,
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating }
|
||||
params: {
|
||||
id: notification_setting,
|
||||
notification_setting: { level: :participating }
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe Oauth::ApplicationsController do
|
|||
|
||||
describe 'POST #create' do
|
||||
it 'creates an application' do
|
||||
post :create, oauth_params
|
||||
post :create, params: oauth_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to redirect_to(oauth_application_path(Doorkeeper::Application.last))
|
||||
|
|
@ -35,7 +35,7 @@ describe Oauth::ApplicationsController do
|
|||
it 'redirects back to profile page if OAuth applications are disabled' do
|
||||
disable_user_oauth
|
||||
|
||||
post :create, oauth_params
|
||||
post :create, params: oauth_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(response).to redirect_to(profile_path)
|
||||
|
|
@ -52,7 +52,7 @@ describe Oauth::ApplicationsController do
|
|||
}
|
||||
}
|
||||
|
||||
post :create, invalid_uri_params
|
||||
post :create, params: invalid_uri_params
|
||||
|
||||
expect(response.body).to include 'Redirect URI is forbidden by the server'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ describe Oauth::AuthorizationsController do
|
|||
render_views
|
||||
|
||||
it 'returns 200 code and renders view' do
|
||||
get :new, params
|
||||
get :new, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template('doorkeeper/authorizations/new')
|
||||
|
|
@ -40,7 +40,7 @@ describe Oauth::AuthorizationsController do
|
|||
application.update(trusted: true)
|
||||
request.session['user_return_to'] = 'http://example.com'
|
||||
|
||||
get :new, params
|
||||
get :new, params: params
|
||||
|
||||
expect(request.session['user_return_to']).to be_nil
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -57,7 +57,7 @@ describe Oauth::AuthorizationsController do
|
|||
end
|
||||
|
||||
it 'authorizes the request and redirects' do
|
||||
get :new, params
|
||||
get :new, params: params
|
||||
|
||||
expect(request.session['user_return_to']).to be_nil
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe PasswordsController do
|
|||
let(:user) { create(:omniauth_user, provider: 'ldapmain', email: 'ldapuser@gitlab.com') }
|
||||
|
||||
it 'prevents a password reset' do
|
||||
post :create, user: { email: user.email }
|
||||
post :create, params: { user: { email: user.email } }
|
||||
|
||||
expect(flash[:alert]).to eq 'Password authentication is unavailable.'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe Profiles::AccountsController do
|
|||
end
|
||||
|
||||
it 'renders 404 if someone tries to unlink a non existent provider' do
|
||||
delete :unlink, provider: 'github'
|
||||
delete :unlink, params: { provider: 'github' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -21,7 +21,7 @@ describe Profiles::AccountsController do
|
|||
it "does not allow to unlink connected account" do
|
||||
identity = user.identities.last
|
||||
|
||||
delete :unlink, provider: provider.to_s
|
||||
delete :unlink, params: { provider: provider.to_s }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(user.reload.identities).to include(identity)
|
||||
|
|
@ -36,7 +36,7 @@ describe Profiles::AccountsController do
|
|||
it 'allows to unlink connected account' do
|
||||
identity = user.identities.last
|
||||
|
||||
delete :unlink, provider: provider.to_s
|
||||
delete :unlink, params: { provider: provider.to_s }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(user.reload.identities).not_to include(identity)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Profiles::EmailsController do
|
|||
let(:email_params) { { email: "add_email@example.com" } }
|
||||
|
||||
it 'sends an email confirmation' do
|
||||
expect { post(:create, { email: email_params }) }.to change { ActionMailer::Base.deliveries.size }
|
||||
expect { post(:create, params: { email: email_params }) }.to change { ActionMailer::Base.deliveries.size }
|
||||
expect(ActionMailer::Base.deliveries.last.to).to eq [email_params[:email]]
|
||||
expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions"
|
||||
end
|
||||
|
|
@ -23,13 +23,13 @@ describe Profiles::EmailsController do
|
|||
it 'resends an email confirmation' do
|
||||
email = user.emails.create(email: 'add_email@example.com')
|
||||
|
||||
expect { put(:resend_confirmation_instructions, { id: email }) }.to change { ActionMailer::Base.deliveries.size }
|
||||
expect { put(:resend_confirmation_instructions, params: { id: email }) }.to change { ActionMailer::Base.deliveries.size }
|
||||
expect(ActionMailer::Base.deliveries.last.to).to eq [email_params[:email]]
|
||||
expect(ActionMailer::Base.deliveries.last.subject).to match "Confirmation instructions"
|
||||
end
|
||||
|
||||
it 'unable to resend an email confirmation' do
|
||||
expect { put(:resend_confirmation_instructions, { id: 1 }) }.not_to change { ActionMailer::Base.deliveries.size }
|
||||
expect { put(:resend_confirmation_instructions, params: { id: 1 }) }.not_to change { ActionMailer::Base.deliveries.size }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe Profiles::KeysController do
|
|||
describe "#get_keys" do
|
||||
describe "non existent user" do
|
||||
it "does not generally work" do
|
||||
get :get_keys, username: 'not-existent'
|
||||
get :get_keys, params: { username: 'not-existent' }
|
||||
|
||||
expect(response).not_to be_success
|
||||
end
|
||||
|
|
@ -14,19 +14,19 @@ describe Profiles::KeysController do
|
|||
|
||||
describe "user with no keys" do
|
||||
it "does generally work" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "renders all keys separated with a new line" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
|
||||
expect(response.body).to eq("")
|
||||
end
|
||||
|
||||
it "responds with text/plain content type" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
expect(response.content_type).to eq("text/plain")
|
||||
end
|
||||
end
|
||||
|
|
@ -37,13 +37,13 @@ describe Profiles::KeysController do
|
|||
let!(:deploy_key) { create(:deploy_key, user: user) }
|
||||
|
||||
it "does generally work" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "renders all non deploy keys separated with a new line" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
|
||||
expect(response.body).not_to eq('')
|
||||
expect(response.body).to eq(user.all_ssh_keys.join("\n"))
|
||||
|
|
@ -55,13 +55,13 @@ describe Profiles::KeysController do
|
|||
end
|
||||
|
||||
it "does not render the comment of the key" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
|
||||
expect(response.body).not_to match(/dummy@gitlab.com/)
|
||||
end
|
||||
|
||||
it "responds with text/plain content type" do
|
||||
get :get_keys, username: user.username
|
||||
get :get_keys, params: { username: user.username }
|
||||
|
||||
expect(response.content_type).to eq("text/plain")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ describe Profiles::NotificationsController do
|
|||
it 'updates only permitted attributes' do
|
||||
sign_in(user)
|
||||
|
||||
put :update, user: { notification_email: 'new@example.com', notified_of_own_activity: true, admin: true }
|
||||
put :update, params: { user: { notification_email: 'new@example.com', notified_of_own_activity: true, admin: true } }
|
||||
|
||||
user.reload
|
||||
expect(user.notification_email).to eq('new@example.com')
|
||||
|
|
@ -36,7 +36,7 @@ describe Profiles::NotificationsController do
|
|||
it 'shows an error message if the params are invalid' do
|
||||
sign_in(user)
|
||||
|
||||
put :update, user: { notification_email: '' }
|
||||
put :update, params: { user: { notification_email: '' } }
|
||||
|
||||
expect(user.reload.notification_email).to eq('original@example.com')
|
||||
expect(controller).to set_flash[:alert].to('Failed to save new settings')
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Profiles::PersonalAccessTokensController do
|
|||
name = 'My PAT'
|
||||
scopes = %w[api read_user]
|
||||
|
||||
post :create, personal_access_token: token_attributes.merge(scopes: scopes, name: name)
|
||||
post :create, params: { personal_access_token: token_attributes.merge(scopes: scopes, name: name) }
|
||||
|
||||
expect(created_token).not_to be_nil
|
||||
expect(created_token.name).to eq(name)
|
||||
|
|
@ -28,7 +28,7 @@ describe Profiles::PersonalAccessTokensController do
|
|||
it "allows creation of a token with an expiry date" do
|
||||
expires_at = 5.days.from_now.to_date
|
||||
|
||||
post :create, personal_access_token: token_attributes.merge(expires_at: expires_at)
|
||||
post :create, params: { personal_access_token: token_attributes.merge(expires_at: expires_at) }
|
||||
|
||||
expect(created_token).not_to be_nil
|
||||
expect(created_token.expires_at).to eq(expires_at)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ describe Profiles::PreferencesController do
|
|||
theme_id: '1'
|
||||
)
|
||||
|
||||
patch :update, user: params, format: format
|
||||
patch :update, params: { user: params }, format: format
|
||||
end
|
||||
|
||||
context 'on successful update' do
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ describe Profiles::TwoFactorAuthsController do
|
|||
let(:pin) { 'pin-code' }
|
||||
|
||||
def go
|
||||
post :create, pin_code: pin
|
||||
post :create, params: { pin_code: pin }
|
||||
end
|
||||
|
||||
context 'with valid pin' do
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe ProfilesController, :request_store do
|
|||
|
||||
expect do
|
||||
post :update,
|
||||
user: { password: 'hello12345', password_confirmation: 'hello12345' }
|
||||
params: { user: { password: 'hello12345', password_confirmation: 'hello12345' } }
|
||||
end.not_to change { user.reload.encrypted_password }
|
||||
|
||||
expect(response.status).to eq(302)
|
||||
|
|
@ -21,7 +21,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update,
|
||||
user: { email: "john@gmail.com", name: "John" }
|
||||
params: { user: { email: "john@gmail.com", name: "John" } }
|
||||
|
||||
user.reload
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update,
|
||||
user: { email: "john@gmail.com", name: "John" }
|
||||
params: { user: { email: "john@gmail.com", name: "John" } }
|
||||
|
||||
user.reload
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(ldap_user)
|
||||
|
||||
put :update,
|
||||
user: { email: "john@gmail.com", name: "John" }
|
||||
params: { user: { email: "john@gmail.com", name: "John" } }
|
||||
|
||||
ldap_user.reload
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(ldap_user)
|
||||
|
||||
put :update,
|
||||
user: { email: "john@gmail.com", name: "John", location: "City, Country" }
|
||||
params: { user: { email: "john@gmail.com", name: "John", location: "City, Country" } }
|
||||
|
||||
ldap_user.reload
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ describe ProfilesController, :request_store do
|
|||
it 'allows setting a user status' do
|
||||
sign_in(user)
|
||||
|
||||
put :update, user: { status: { message: 'Working hard!' } }
|
||||
put :update, params: { user: { status: { message: 'Working hard!' } } }
|
||||
|
||||
expect(user.reload.status.message).to eq('Working hard!')
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -98,7 +98,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update_username,
|
||||
user: { username: new_username }
|
||||
params: { user: { username: new_username } }
|
||||
|
||||
user.reload
|
||||
|
||||
|
|
@ -110,7 +110,9 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update_username,
|
||||
user: { username: new_username },
|
||||
params: {
|
||||
user: { username: new_username }
|
||||
},
|
||||
format: :json
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
|
|
@ -121,7 +123,9 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update_username,
|
||||
user: { username: 'invalid username.git' },
|
||||
params: {
|
||||
user: { username: 'invalid username.git' }
|
||||
},
|
||||
format: :json
|
||||
|
||||
expect(response.status).to eq(422)
|
||||
|
|
@ -131,7 +135,7 @@ describe ProfilesController, :request_store do
|
|||
it 'raises a correct error when the username is missing' do
|
||||
sign_in(user)
|
||||
|
||||
expect { put :update_username, user: { gandalf: 'you shall not pass' } }
|
||||
expect { put :update_username, params: { user: { gandalf: 'you shall not pass' } } }
|
||||
.to raise_error(ActionController::ParameterMissing)
|
||||
end
|
||||
|
||||
|
|
@ -142,7 +146,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update_username,
|
||||
user: { username: new_username }
|
||||
params: { user: { username: new_username } }
|
||||
|
||||
user.reload
|
||||
|
||||
|
|
@ -160,7 +164,7 @@ describe ProfilesController, :request_store do
|
|||
sign_in(user)
|
||||
|
||||
put :update_username,
|
||||
user: { username: new_username }
|
||||
params: { user: { username: new_username } }
|
||||
|
||||
user.reload
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe Projects::ArtifactsController do
|
|||
def download_artifact(extra_params = {})
|
||||
params = { namespace_id: project.namespace, project_id: project, job_id: job }.merge(extra_params)
|
||||
|
||||
get :download, params
|
||||
get :download, params: params
|
||||
end
|
||||
|
||||
context 'when no file type is supplied' do
|
||||
|
|
@ -86,7 +86,7 @@ describe Projects::ArtifactsController do
|
|||
describe 'GET browse' do
|
||||
context 'when the directory exists' do
|
||||
it 'renders the browse view' do
|
||||
get :browse, namespace_id: project.namespace, project_id: project, job_id: job, path: 'other_artifacts_0.1.2'
|
||||
get :browse, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'other_artifacts_0.1.2' }
|
||||
|
||||
expect(response).to render_template('projects/artifacts/browse')
|
||||
end
|
||||
|
|
@ -94,7 +94,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'when the directory does not exist' do
|
||||
it 'responds Not Found' do
|
||||
get :browse, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
|
||||
get :browse, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown' }
|
||||
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -113,7 +113,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'when the file exists' do
|
||||
it 'renders the file view' do
|
||||
get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt'
|
||||
get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -121,7 +121,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'when the file does not exist' do
|
||||
it 'responds Not Found' do
|
||||
get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
|
||||
get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown' }
|
||||
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -131,7 +131,7 @@ describe Projects::ArtifactsController do
|
|||
context 'when the file is served through Rails' do
|
||||
context 'when the file exists' do
|
||||
it 'renders the file view' do
|
||||
get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt'
|
||||
get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'ci_artifacts.txt' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('projects/artifacts/file')
|
||||
|
|
@ -140,7 +140,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'when the file does not exist' do
|
||||
it 'responds Not Found' do
|
||||
get :file, namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown'
|
||||
get :file, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: 'unknown' }
|
||||
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -159,7 +159,7 @@ describe Projects::ArtifactsController do
|
|||
end
|
||||
|
||||
it 'does not redirect the request' do
|
||||
get :file, namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt'
|
||||
get :file, params: { namespace_id: private_project.namespace, project_id: private_project, job_id: job, path: 'ci_artifacts.txt' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('projects/artifacts/file')
|
||||
|
|
@ -168,7 +168,7 @@ describe Projects::ArtifactsController do
|
|||
end
|
||||
|
||||
describe 'GET raw' do
|
||||
subject { get(:raw, namespace_id: project.namespace, project_id: project, job_id: job, path: path) }
|
||||
subject { get(:raw, params: { namespace_id: project.namespace, project_id: project, job_id: job, path: path }) }
|
||||
|
||||
context 'when the file exists' do
|
||||
let(:path) { 'ci_artifacts.txt' }
|
||||
|
|
@ -239,7 +239,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'has no such ref' do
|
||||
before do
|
||||
get :latest_succeeded, params_from_ref('TAIL', job.name)
|
||||
get :latest_succeeded, params: params_from_ref('TAIL', job.name)
|
||||
end
|
||||
|
||||
it_behaves_like 'not found'
|
||||
|
|
@ -247,7 +247,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'has no such job' do
|
||||
before do
|
||||
get :latest_succeeded, params_from_ref(pipeline.ref, 'NOBUILD')
|
||||
get :latest_succeeded, params: params_from_ref(pipeline.ref, 'NOBUILD')
|
||||
end
|
||||
|
||||
it_behaves_like 'not found'
|
||||
|
|
@ -255,7 +255,7 @@ describe Projects::ArtifactsController do
|
|||
|
||||
context 'has no path' do
|
||||
before do
|
||||
get :latest_succeeded, params_from_ref(pipeline.sha, job.name, '')
|
||||
get :latest_succeeded, params: params_from_ref(pipeline.sha, job.name, '')
|
||||
end
|
||||
|
||||
it_behaves_like 'not found'
|
||||
|
|
@ -276,7 +276,7 @@ describe Projects::ArtifactsController do
|
|||
pipeline.update(ref: 'master',
|
||||
sha: project.commit('master').sha)
|
||||
|
||||
get :latest_succeeded, params_from_ref('master')
|
||||
get :latest_succeeded, params: params_from_ref('master')
|
||||
end
|
||||
|
||||
it_behaves_like 'redirect to the job'
|
||||
|
|
@ -287,7 +287,7 @@ describe Projects::ArtifactsController do
|
|||
pipeline.update(ref: 'improve/awesome',
|
||||
sha: project.commit('improve/awesome').sha)
|
||||
|
||||
get :latest_succeeded, params_from_ref('improve/awesome')
|
||||
get :latest_succeeded, params: params_from_ref('improve/awesome')
|
||||
end
|
||||
|
||||
it_behaves_like 'redirect to the job'
|
||||
|
|
@ -298,7 +298,7 @@ describe Projects::ArtifactsController do
|
|||
pipeline.update(ref: 'improve/awesome',
|
||||
sha: project.commit('improve/awesome').sha)
|
||||
|
||||
get :latest_succeeded, params_from_ref('improve/awesome', job.name, 'file/README.md')
|
||||
get :latest_succeeded, params: params_from_ref('improve/awesome', job.name, 'file/README.md')
|
||||
end
|
||||
|
||||
it 'redirects' do
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ describe Projects::AvatarsController do
|
|||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
subject { get :show, namespace_id: project.namespace, project_id: project }
|
||||
subject { get :show, params: { namespace_id: project.namespace, project_id: project } }
|
||||
|
||||
context 'when repository has no avatar' do
|
||||
it 'shows 404' do
|
||||
|
|
@ -71,7 +71,7 @@ describe Projects::AvatarsController do
|
|||
|
||||
describe 'DELETE #destroy' do
|
||||
it 'removes avatar from DB by calling destroy' do
|
||||
delete :destroy, namespace_id: project.namespace.id, project_id: project.id
|
||||
delete :destroy, params: { namespace_id: project.namespace.id, project_id: project.id }
|
||||
|
||||
expect(project.avatar.present?).to be_falsey
|
||||
expect(project).to be_valid
|
||||
|
|
|
|||
|
|
@ -23,6 +23,6 @@ describe Projects::BadgesController do
|
|||
end
|
||||
|
||||
def get_badge(badge)
|
||||
get badge, namespace_id: project.namespace.to_param, project_id: project, ref: pipeline.ref, format: :svg
|
||||
get badge, params: { namespace_id: project.namespace.to_param, project_id: project, ref: pipeline.ref }, format: :svg
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@ describe Projects::BlameController do
|
|||
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
})
|
||||
end
|
||||
|
||||
context "valid file" do
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ describe Projects::BlobController do
|
|||
context 'with file path' do
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
})
|
||||
end
|
||||
|
||||
context "valid branch, valid file" do
|
||||
|
|
@ -48,9 +50,11 @@ describe Projects::BlobController do
|
|||
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
},
|
||||
format: :json)
|
||||
end
|
||||
|
||||
|
|
@ -66,11 +70,13 @@ describe Projects::BlobController do
|
|||
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id,
|
||||
format: :json,
|
||||
viewer: 'none')
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id,
|
||||
viewer: 'none'
|
||||
},
|
||||
format: :json)
|
||||
end
|
||||
|
||||
it do
|
||||
|
|
@ -84,9 +90,11 @@ describe Projects::BlobController do
|
|||
context 'with tree path' do
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
})
|
||||
controller.instance_variable_set(:@blob, nil)
|
||||
end
|
||||
|
||||
|
|
@ -109,7 +117,7 @@ describe Projects::BlobController do
|
|||
params = { namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: 'master/CHANGELOG' }
|
||||
get :diff, params.merge(opts)
|
||||
get :diff, params: params.merge(opts)
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
@ -200,7 +208,7 @@ describe Projects::BlobController do
|
|||
|
||||
context 'anonymous' do
|
||||
before do
|
||||
get :edit, default_params
|
||||
get :edit, params: default_params
|
||||
end
|
||||
|
||||
it 'redirects to sign in and returns' do
|
||||
|
|
@ -213,7 +221,7 @@ describe Projects::BlobController do
|
|||
|
||||
before do
|
||||
sign_in(guest)
|
||||
get :edit, default_params
|
||||
get :edit, params: default_params
|
||||
end
|
||||
|
||||
it 'redirects to blob show' do
|
||||
|
|
@ -227,7 +235,7 @@ describe Projects::BlobController do
|
|||
before do
|
||||
project.add_developer(developer)
|
||||
sign_in(developer)
|
||||
get :edit, default_params
|
||||
get :edit, params: default_params
|
||||
end
|
||||
|
||||
it 'redirects to blob show' do
|
||||
|
|
@ -241,7 +249,7 @@ describe Projects::BlobController do
|
|||
before do
|
||||
project.add_maintainer(maintainer)
|
||||
sign_in(maintainer)
|
||||
get :edit, default_params
|
||||
get :edit, params: default_params
|
||||
end
|
||||
|
||||
it 'redirects to blob show' do
|
||||
|
|
@ -274,7 +282,7 @@ describe Projects::BlobController do
|
|||
end
|
||||
|
||||
it 'redirects to blob' do
|
||||
put :update, default_params
|
||||
put :update, params: default_params
|
||||
|
||||
expect(response).to redirect_to(blob_after_edit_path)
|
||||
end
|
||||
|
|
@ -284,7 +292,7 @@ describe Projects::BlobController do
|
|||
let(:mr_params) { default_params.merge(from_merge_request_iid: merge_request.iid) }
|
||||
|
||||
it 'redirects to MR diff' do
|
||||
put :update, mr_params
|
||||
put :update, params: mr_params
|
||||
|
||||
after_edit_path = diffs_project_merge_request_path(project, merge_request)
|
||||
file_anchor = "##{Digest::SHA1.hexdigest('CHANGELOG')}"
|
||||
|
|
@ -298,7 +306,7 @@ describe Projects::BlobController do
|
|||
end
|
||||
|
||||
it "it redirect to blob" do
|
||||
put :update, mr_params
|
||||
put :update, params: mr_params
|
||||
|
||||
expect(response).to redirect_to(blob_after_edit_path)
|
||||
end
|
||||
|
|
@ -320,7 +328,7 @@ describe Projects::BlobController do
|
|||
end
|
||||
|
||||
it 'redirects to blob' do
|
||||
put :update, default_params
|
||||
put :update, params: default_params
|
||||
|
||||
expect(response).to redirect_to(project_blob_path(forked_project, 'master/CHANGELOG'))
|
||||
end
|
||||
|
|
@ -331,7 +339,7 @@ describe Projects::BlobController do
|
|||
default_params[:branch_name] = "fork-test-1"
|
||||
default_params[:create_merge_request] = 1
|
||||
|
||||
put :update, default_params
|
||||
put :update, params: default_params
|
||||
|
||||
expect(response).to redirect_to(
|
||||
project_new_merge_request_path(
|
||||
|
|
@ -374,7 +382,7 @@ describe Projects::BlobController do
|
|||
let(:after_delete_path) { project_tree_path(project, 'master/files') }
|
||||
|
||||
it 'redirects to the sub directory' do
|
||||
delete :destroy, default_params
|
||||
delete :destroy, params: default_params
|
||||
|
||||
expect(response).to redirect_to(after_delete_path)
|
||||
end
|
||||
|
|
@ -393,7 +401,7 @@ describe Projects::BlobController do
|
|||
end
|
||||
|
||||
it 'redirects to the project root' do
|
||||
delete :destroy, default_params
|
||||
delete :destroy, params: default_params
|
||||
|
||||
expect(response).to redirect_to(project_root_path)
|
||||
end
|
||||
|
|
@ -413,7 +421,7 @@ describe Projects::BlobController do
|
|||
let(:after_delete_path) { project_tree_path(project, 'binary-encoding') }
|
||||
|
||||
it 'redirects to the project root of the branch' do
|
||||
delete :destroy, default_params
|
||||
delete :destroy, params: default_params
|
||||
|
||||
expect(response).to redirect_to(after_delete_path)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -121,8 +121,10 @@ describe Projects::BoardsController do
|
|||
end
|
||||
|
||||
def list_boards(format: :html)
|
||||
get :index, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
get :index, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
},
|
||||
format: format
|
||||
end
|
||||
end
|
||||
|
|
@ -207,9 +209,11 @@ describe Projects::BoardsController do
|
|||
end
|
||||
|
||||
def read_board(board:, format: :html)
|
||||
get :show, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: board.to_param,
|
||||
get :show, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: board.to_param
|
||||
},
|
||||
format: format
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,10 +22,12 @@ describe Projects::BranchesController do
|
|||
sign_in(user)
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
ref: ref
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
ref: ref
|
||||
}
|
||||
end
|
||||
|
||||
context "valid branch name, valid source" do
|
||||
|
|
@ -76,10 +78,12 @@ describe Projects::BranchesController do
|
|||
|
||||
it 'redirects' do
|
||||
post :create,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
|
||||
expect(subject)
|
||||
.to redirect_to("/#{project.full_path}/tree/1-feature-branch")
|
||||
|
|
@ -89,10 +93,12 @@ describe Projects::BranchesController do
|
|||
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch")
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
end
|
||||
|
||||
context 'repository-less project' do
|
||||
|
|
@ -105,10 +111,12 @@ describe Projects::BranchesController do
|
|||
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
|
||||
expect(response).to redirect_to project_tree_path(project, branch)
|
||||
end
|
||||
|
|
@ -121,10 +129,12 @@ describe Projects::BranchesController do
|
|||
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
|
||||
expect(response.location).to include(project_new_blob_path(project, branch))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -156,10 +166,12 @@ describe Projects::BranchesController do
|
|||
expect(SystemNoteService).to receive(:new_issue_branch).and_return(true)
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
|
||||
expect(response.location).to include(project_new_blob_path(project, branch))
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -173,10 +185,12 @@ describe Projects::BranchesController do
|
|||
expect(SystemNoteService).not_to receive(:new_issue_branch)
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -191,10 +205,12 @@ describe Projects::BranchesController do
|
|||
expect(SystemNoteService).not_to receive(:new_issue_branch)
|
||||
|
||||
post :create,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
branch_name: branch,
|
||||
issue_iid: issue.iid
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -228,11 +244,14 @@ describe Projects::BranchesController do
|
|||
end
|
||||
|
||||
def create_branch(name:, ref:)
|
||||
post :create, namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: name,
|
||||
ref: ref,
|
||||
format: :json
|
||||
post :create,
|
||||
format: :json,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
branch_name: name,
|
||||
ref: ref
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -246,9 +265,11 @@ describe Projects::BranchesController do
|
|||
it 'returns 303' do
|
||||
post :destroy,
|
||||
format: :html,
|
||||
id: 'foo/bar/baz',
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
params: {
|
||||
id: 'foo/bar/baz',
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(303)
|
||||
end
|
||||
|
|
@ -261,10 +282,12 @@ describe Projects::BranchesController do
|
|||
sign_in(user)
|
||||
|
||||
post :destroy,
|
||||
format: format,
|
||||
id: branch,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
format: format,
|
||||
params: {
|
||||
id: branch,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
}
|
||||
end
|
||||
|
||||
context 'as JS' do
|
||||
|
|
@ -359,8 +382,10 @@ describe Projects::BranchesController do
|
|||
describe "DELETE destroy_all_merged" do
|
||||
def destroy_all_merged
|
||||
delete :destroy_all_merged,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
}
|
||||
end
|
||||
|
||||
context 'when user is allowed to push' do
|
||||
|
|
@ -404,10 +429,12 @@ describe Projects::BranchesController do
|
|||
context 'when rendering a JSON format' do
|
||||
it 'filters branches by name' do
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
format: :json,
|
||||
search: 'master'
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
search: 'master'
|
||||
}
|
||||
|
||||
parsed_response = JSON.parse(response.body)
|
||||
|
||||
|
|
@ -423,10 +450,12 @@ describe Projects::BranchesController do
|
|||
context 'when cache is enabled yet cold', :request_store do
|
||||
it 'return with a status 200' do
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
state: 'all',
|
||||
format: :html
|
||||
format: :html,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
state: 'all'
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -439,10 +468,12 @@ describe Projects::BranchesController do
|
|||
|
||||
it 'return with a status 200' do
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
state: 'all',
|
||||
format: :html
|
||||
format: :html,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
state: 'all'
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -451,30 +482,36 @@ describe Projects::BranchesController do
|
|||
context 'when deprecated sort/search/page parameters are specified' do
|
||||
it 'returns with a status 301 when sort specified' do
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
sort: 'updated_asc',
|
||||
format: :html
|
||||
format: :html,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
sort: 'updated_asc'
|
||||
}
|
||||
|
||||
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
|
||||
end
|
||||
|
||||
it 'returns with a status 301 when search specified' do
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
search: 'feature',
|
||||
format: :html
|
||||
format: :html,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
search: 'feature'
|
||||
}
|
||||
|
||||
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
|
||||
end
|
||||
|
||||
it 'returns with a status 301 when page specified' do
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
page: 2,
|
||||
format: :html
|
||||
format: :html,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
page: 2
|
||||
}
|
||||
|
||||
expect(response).to redirect_to project_branches_filtered_path(project, state: 'all')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe Projects::Ci::LintsController do
|
|||
before do
|
||||
project.add_developer(user)
|
||||
|
||||
get :show, namespace_id: project.namespace, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project }
|
||||
end
|
||||
|
||||
it 'should be success' do
|
||||
|
|
@ -33,7 +33,7 @@ describe Projects::Ci::LintsController do
|
|||
before do
|
||||
project.add_guest(user)
|
||||
|
||||
get :show, namespace_id: project.namespace, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace, project_id: project }
|
||||
end
|
||||
|
||||
it 'should respond with 404' do
|
||||
|
|
@ -72,7 +72,7 @@ describe Projects::Ci::LintsController do
|
|||
WebMock.stub_request(:get, remote_file_path).to_return(body: remote_file_content)
|
||||
project.add_developer(user)
|
||||
|
||||
post :create, namespace_id: project.namespace, project_id: project, content: content
|
||||
post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
|
||||
end
|
||||
|
||||
it 'should be success' do
|
||||
|
|
@ -100,7 +100,7 @@ describe Projects::Ci::LintsController do
|
|||
before do
|
||||
project.add_developer(user)
|
||||
|
||||
post :create, namespace_id: project.namespace, project_id: project, content: content
|
||||
post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
|
||||
end
|
||||
|
||||
it 'should assign errors' do
|
||||
|
|
@ -112,7 +112,7 @@ describe Projects::Ci::LintsController do
|
|||
before do
|
||||
project.add_guest(user)
|
||||
|
||||
post :create, namespace_id: project.namespace, project_id: project, content: content
|
||||
post :create, params: { namespace_id: project.namespace, project_id: project, content: content }
|
||||
end
|
||||
|
||||
it 'should respond with 404' do
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ describe Projects::Clusters::ApplicationsController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create, params.merge(namespace_id: project.namespace, project_id: project)
|
||||
post :create, params: params.merge(namespace_id: project.namespace, project_id: project)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe Projects::ClustersController do
|
|||
|
||||
describe 'GET index' do
|
||||
def go(params = {})
|
||||
get :index, params.reverse_merge(namespace_id: project.namespace.to_param, project_id: project)
|
||||
get :index, params: params.reverse_merge(namespace_id: project.namespace.to_param, project_id: project)
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -80,7 +80,7 @@ describe Projects::ClustersController do
|
|||
|
||||
describe 'GET new' do
|
||||
def go
|
||||
get :new, namespace_id: project.namespace, project_id: project
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
end
|
||||
|
||||
describe 'functionality for new cluster' do
|
||||
|
|
@ -174,7 +174,7 @@ describe Projects::ClustersController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create_gcp, params.merge(namespace_id: project.namespace, project_id: project)
|
||||
post :create_gcp, params: params.merge(namespace_id: project.namespace, project_id: project)
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -261,7 +261,7 @@ describe Projects::ClustersController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create_user, params.merge(namespace_id: project.namespace, project_id: project)
|
||||
post :create_user, params: params.merge(namespace_id: project.namespace, project_id: project)
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -331,9 +331,11 @@ describe Projects::ClustersController do
|
|||
|
||||
def go
|
||||
get :cluster_status,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
id: cluster,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
id: cluster
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
|
|
@ -369,9 +371,11 @@ describe Projects::ClustersController do
|
|||
|
||||
def go
|
||||
get :show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: cluster
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: cluster
|
||||
}
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
@ -397,11 +401,11 @@ describe Projects::ClustersController do
|
|||
|
||||
describe 'PUT update' do
|
||||
def go(format: :html)
|
||||
put :update, params.merge(namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
id: cluster,
|
||||
format: format
|
||||
)
|
||||
put :update, params: params.merge(namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
id: cluster,
|
||||
format: format
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
@ -500,9 +504,11 @@ describe Projects::ClustersController do
|
|||
|
||||
def go
|
||||
delete :destroy,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: cluster
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: cluster
|
||||
}
|
||||
end
|
||||
|
||||
describe 'functionality' do
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ describe Projects::CommitController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :show, params.merge(extra_params)
|
||||
get :show, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
context 'with valid id' do
|
||||
|
|
@ -102,9 +102,11 @@ describe Projects::CommitController do
|
|||
|
||||
it 'renders it' do
|
||||
get(:show,
|
||||
namespace_id: fork_project.namespace,
|
||||
project_id: fork_project,
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: fork_project.namespace,
|
||||
project_id: fork_project,
|
||||
id: commit.id
|
||||
})
|
||||
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
|
@ -132,9 +134,11 @@ describe Projects::CommitController do
|
|||
commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e')
|
||||
|
||||
get(:branches,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: commit.id
|
||||
})
|
||||
|
||||
expect(assigns(:branches)).to include('master', 'feature_conflict')
|
||||
expect(assigns(:branches_limit_exceeded)).to be_falsey
|
||||
|
|
@ -148,9 +152,11 @@ describe Projects::CommitController do
|
|||
allow_any_instance_of(Repository).to receive(:tag_count).and_return(1001)
|
||||
|
||||
get(:branches,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: commit.id
|
||||
})
|
||||
|
||||
expect(assigns(:branches)).to eq([])
|
||||
expect(assigns(:branches_limit_exceeded)).to be_truthy
|
||||
|
|
@ -163,9 +169,11 @@ describe Projects::CommitController do
|
|||
context 'when target branch is not provided' do
|
||||
it 'renders the 404 page' do
|
||||
post(:revert,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: commit.id
|
||||
})
|
||||
|
||||
expect(response).not_to be_success
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
|
|
@ -175,10 +183,12 @@ describe Projects::CommitController do
|
|||
context 'when the revert was successful' do
|
||||
it 'redirects to the commits page' do
|
||||
post(:revert,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: commit.id
|
||||
})
|
||||
|
||||
expect(response).to redirect_to project_commits_path(project, 'master')
|
||||
expect(flash[:notice]).to eq('The commit has been successfully reverted.')
|
||||
|
|
@ -188,19 +198,23 @@ describe Projects::CommitController do
|
|||
context 'when the revert failed' do
|
||||
before do
|
||||
post(:revert,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: commit.id
|
||||
})
|
||||
end
|
||||
|
||||
it 'redirects to the commit page' do
|
||||
# Reverting a commit that has been already reverted.
|
||||
post(:revert,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: commit.id
|
||||
})
|
||||
|
||||
expect(response).to redirect_to project_commit_path(project, commit.id)
|
||||
expect(flash[:alert]).to match('Sorry, we cannot revert this commit automatically.')
|
||||
|
|
@ -212,9 +226,11 @@ describe Projects::CommitController do
|
|||
context 'when target branch is not provided' do
|
||||
it 'renders the 404 page' do
|
||||
post(:cherry_pick,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: master_pickable_commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: master_pickable_commit.id
|
||||
})
|
||||
|
||||
expect(response).not_to be_success
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
|
|
@ -224,10 +240,12 @@ describe Projects::CommitController do
|
|||
context 'when the cherry-pick was successful' do
|
||||
it 'redirects to the commits page' do
|
||||
post(:cherry_pick,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: master_pickable_commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: master_pickable_commit.id
|
||||
})
|
||||
|
||||
expect(response).to redirect_to project_commits_path(project, 'master')
|
||||
expect(flash[:notice]).to eq('The commit has been successfully cherry-picked into master.')
|
||||
|
|
@ -237,19 +255,23 @@ describe Projects::CommitController do
|
|||
context 'when the cherry_pick failed' do
|
||||
before do
|
||||
post(:cherry_pick,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: master_pickable_commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: master_pickable_commit.id
|
||||
})
|
||||
end
|
||||
|
||||
it 'redirects to the commit page' do
|
||||
# Cherry-picking a commit that has been already cherry-picked.
|
||||
post(:cherry_pick,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: master_pickable_commit.id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
start_branch: 'master',
|
||||
id: master_pickable_commit.id
|
||||
})
|
||||
|
||||
expect(response).to redirect_to project_commit_path(project, master_pickable_commit.id)
|
||||
expect(flash[:alert]).to match('Sorry, we cannot cherry-pick this commit automatically.')
|
||||
|
|
@ -264,7 +286,7 @@ describe Projects::CommitController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :diff_for_path, params.merge(extra_params)
|
||||
get :diff_for_path, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
let(:existing_path) { '.gitmodules' }
|
||||
|
|
@ -332,7 +354,7 @@ describe Projects::CommitController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :pipelines, params.merge(extra_params)
|
||||
get :pipelines, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
context 'when the commit exists' do
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@ describe Projects::CommitsController do
|
|||
context "no ref is provided" do
|
||||
it 'should redirect to the default branch of the project' do
|
||||
get(:commits_root,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
})
|
||||
|
||||
expect(response).to redirect_to project_commits_path(project)
|
||||
end
|
||||
|
|
@ -31,9 +33,11 @@ describe Projects::CommitsController do
|
|||
context 'with file path' do
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
})
|
||||
end
|
||||
|
||||
context "valid branch, valid file" do
|
||||
|
|
@ -65,9 +69,11 @@ describe Projects::CommitsController do
|
|||
context "when the ref does not exist with the suffix" do
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: "master.atom")
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: "master.atom"
|
||||
})
|
||||
end
|
||||
|
||||
it "renders as atom" do
|
||||
|
|
@ -88,9 +94,11 @@ describe Projects::CommitsController do
|
|||
allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit)
|
||||
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: "master.atom")
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: "master.atom"
|
||||
})
|
||||
end
|
||||
|
||||
it "renders as HTML" do
|
||||
|
|
@ -106,9 +114,11 @@ describe Projects::CommitsController do
|
|||
|
||||
before do
|
||||
get(:signatures,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
},
|
||||
format: :json)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe Projects::CompareController do
|
|||
render_views
|
||||
|
||||
before do
|
||||
get :index, namespace_id: project.namespace, project_id: project
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
end
|
||||
|
||||
it 'returns successfully' do
|
||||
|
|
@ -24,7 +24,7 @@ describe Projects::CompareController do
|
|||
describe 'GET show' do
|
||||
render_views
|
||||
|
||||
subject(:show_request) { get :show, request_params }
|
||||
subject(:show_request) { get :show, params: request_params }
|
||||
|
||||
let(:request_params) do
|
||||
{
|
||||
|
|
@ -130,7 +130,7 @@ describe Projects::CompareController do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :diff_for_path, params.merge(extra_params)
|
||||
get :diff_for_path, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
let(:existing_path) { 'files/ruby/feature.rb' }
|
||||
|
|
@ -201,7 +201,7 @@ describe Projects::CompareController do
|
|||
end
|
||||
|
||||
describe 'POST create' do
|
||||
subject(:create_request) { post :create, request_params }
|
||||
subject(:create_request) { post :create, params: request_params }
|
||||
|
||||
let(:request_params) do
|
||||
{
|
||||
|
|
@ -260,7 +260,7 @@ describe Projects::CompareController do
|
|||
end
|
||||
|
||||
describe 'GET signatures' do
|
||||
subject(:signatures_request) { get :signatures, request_params }
|
||||
subject(:signatures_request) { get :signatures, params: request_params }
|
||||
|
||||
let(:request_params) do
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ describe Projects::CycleAnalyticsController do
|
|||
context 'with no data' do
|
||||
it 'is true' do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
})
|
||||
|
||||
expect(response).to be_success
|
||||
expect(assigns(:cycle_analytics_no_data)).to eq(true)
|
||||
|
|
@ -32,8 +34,10 @@ describe Projects::CycleAnalyticsController do
|
|||
|
||||
it 'is false' do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
})
|
||||
|
||||
expect(response).to be_success
|
||||
expect(assigns(:cycle_analytics_no_data)).to eq(false)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
context 'when html requested' do
|
||||
it 'redirects to blob' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
|
||||
end
|
||||
|
|
@ -48,7 +48,7 @@ describe Projects::DeployKeysController do
|
|||
end
|
||||
|
||||
it 'returns json in a correct format' do
|
||||
get :index, params.merge(format: :json)
|
||||
get :index, params: params.merge(format: :json)
|
||||
|
||||
json = JSON.parse(response.body)
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
it 'redirects to login' do
|
||||
expect do
|
||||
put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.not_to change { DeployKeysProject.count }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
|
|
@ -89,7 +89,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
it 'returns 404' do
|
||||
expect do
|
||||
put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.not_to change { DeployKeysProject.count }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
|
|
@ -103,7 +103,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
it 'returns 302' do
|
||||
expect do
|
||||
put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.to change { DeployKeysProject.count }.by(1)
|
||||
|
||||
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
|
||||
|
|
@ -112,7 +112,7 @@ describe Projects::DeployKeysController do
|
|||
end
|
||||
|
||||
it 'returns 404' do
|
||||
put :enable, id: 0, namespace_id: project.namespace, project_id: project
|
||||
put :enable, params: { id: 0, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
|
|
@ -125,7 +125,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
it 'returns 302' do
|
||||
expect do
|
||||
put :enable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :enable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.to change { DeployKeysProject.count }.by(1)
|
||||
|
||||
expect(DeployKeysProject.where(project_id: project.id, deploy_key_id: deploy_key.id).count).to eq(1)
|
||||
|
|
@ -145,7 +145,7 @@ describe Projects::DeployKeysController do
|
|||
end
|
||||
|
||||
it 'redirects to login' do
|
||||
put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
|
|
@ -159,7 +159,7 @@ describe Projects::DeployKeysController do
|
|||
end
|
||||
|
||||
it 'returns 404' do
|
||||
put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
expect(DeployKey.find(deploy_key.id)).to eq(deploy_key)
|
||||
|
|
@ -168,7 +168,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
context 'with user with permission' do
|
||||
it 'returns 302' do
|
||||
put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(response).to redirect_to(namespace_project_settings_repository_path(anchor: 'js-deploy-keys-settings'))
|
||||
|
|
@ -177,7 +177,7 @@ describe Projects::DeployKeysController do
|
|||
end
|
||||
|
||||
it 'returns 404' do
|
||||
put :disable, id: 0, namespace_id: project.namespace, project_id: project
|
||||
put :disable, params: { id: 0, namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
|
|
@ -190,7 +190,7 @@ describe Projects::DeployKeysController do
|
|||
|
||||
it 'returns 302' do
|
||||
expect do
|
||||
put :disable, id: deploy_key.id, namespace_id: project.namespace, project_id: project
|
||||
put :disable, params: { id: deploy_key.id, namespace_id: project.namespace, project_id: project }
|
||||
end.to change { DeployKey.count }.by(-1)
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ describe Projects::DeploymentsController do
|
|||
create(:deployment, :success, environment: environment, created_at: 7.hours.ago)
|
||||
create(:deployment, :success, environment: environment)
|
||||
|
||||
get :index, deployment_params(after: 8.hours.ago)
|
||||
get :index, params: deployment_params(after: 8.hours.ago)
|
||||
|
||||
expect(response).to be_ok
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ describe Projects::DeploymentsController do
|
|||
it 'returns a list with deployments information' do
|
||||
create(:deployment, :success, environment: environment)
|
||||
|
||||
get :index, deployment_params
|
||||
get :index, params: deployment_params
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(response).to match_response_schema('deployments')
|
||||
|
|
@ -49,7 +49,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'responds with not found' do
|
||||
get :metrics, deployment_params(id: deployment.id)
|
||||
get :metrics, params: deployment_params(id: deployment.id)
|
||||
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -66,7 +66,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'returns a empty response 204 resposne' do
|
||||
get :metrics, deployment_params(id: deployment.id)
|
||||
get :metrics, params: deployment_params(id: deployment.id)
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response.body).to eq('')
|
||||
end
|
||||
|
|
@ -86,7 +86,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'returns a metrics JSON document' do
|
||||
get :metrics, deployment_params(id: deployment.id)
|
||||
get :metrics, params: deployment_params(id: deployment.id)
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(json_response['success']).to be(true)
|
||||
|
|
@ -101,7 +101,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'responds with not found' do
|
||||
get :metrics, deployment_params(id: deployment.id)
|
||||
get :metrics, params: deployment_params(id: deployment.id)
|
||||
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -122,7 +122,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'responds with not found' do
|
||||
get :metrics, deployment_params(id: deployment.id)
|
||||
get :metrics, params: deployment_params(id: deployment.id)
|
||||
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
|
|
@ -141,7 +141,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'returns a empty response 204 response' do
|
||||
get :additional_metrics, deployment_params(id: deployment.id, format: :json)
|
||||
get :additional_metrics, params: deployment_params(id: deployment.id, format: :json)
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(response.body).to eq('')
|
||||
end
|
||||
|
|
@ -161,7 +161,7 @@ describe Projects::DeploymentsController do
|
|||
end
|
||||
|
||||
it 'returns a metrics JSON document' do
|
||||
get :additional_metrics, deployment_params(id: deployment.id, format: :json)
|
||||
get :additional_metrics, params: deployment_params(id: deployment.id, format: :json)
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(json_response['success']).to be(true)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ describe Projects::DiscussionsController do
|
|||
|
||||
context 'when user is not authorized to read the MR' do
|
||||
it 'returns 404' do
|
||||
get :show, request_params, format: :json
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -35,7 +35,7 @@ describe Projects::DiscussionsController do
|
|||
end
|
||||
|
||||
it 'returns status 200' do
|
||||
get :show, request_params, format: :json
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -43,7 +43,7 @@ describe Projects::DiscussionsController do
|
|||
it 'returns status 404 if MR does not exists' do
|
||||
merge_request.destroy!
|
||||
|
||||
get :show, request_params, format: :json
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -56,7 +56,7 @@ describe Projects::DiscussionsController do
|
|||
end
|
||||
|
||||
it 'returns status 200' do
|
||||
get :show, request_params, format: :json
|
||||
get :show, params: request_params, session: { format: :json }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -70,7 +70,7 @@ describe Projects::DiscussionsController do
|
|||
|
||||
context "when the user is not authorized to resolve the discussion" do
|
||||
it "returns status 404" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -87,7 +87,7 @@ describe Projects::DiscussionsController do
|
|||
end
|
||||
|
||||
it "returns status 404" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -95,7 +95,7 @@ describe Projects::DiscussionsController do
|
|||
|
||||
context "when the discussion is resolvable" do
|
||||
it "resolves the discussion" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(note.reload.discussion.resolved?).to be true
|
||||
expect(note.reload.discussion.resolved_by).to eq(user)
|
||||
|
|
@ -104,17 +104,17 @@ describe Projects::DiscussionsController do
|
|||
it "sends notifications if all discussions are resolved" do
|
||||
expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request)
|
||||
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
end
|
||||
|
||||
it "returns the name of the resolving user" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(JSON.parse(response.body)['resolved_by']['name']).to eq(user.name)
|
||||
end
|
||||
|
||||
it "returns status 200" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -123,7 +123,7 @@ describe Projects::DiscussionsController do
|
|||
expect_any_instance_of(DiscussionSerializer).to receive(:represent)
|
||||
.with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true })
|
||||
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
end
|
||||
|
||||
context 'diff discussion' do
|
||||
|
|
@ -131,7 +131,7 @@ describe Projects::DiscussionsController do
|
|||
let(:discussion) { note.discussion }
|
||||
|
||||
it "returns truncated diff lines" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(JSON.parse(response.body)['truncated_diff_lines']).to be_present
|
||||
end
|
||||
|
|
@ -149,7 +149,7 @@ describe Projects::DiscussionsController do
|
|||
|
||||
context "when the user is not authorized to resolve the discussion" do
|
||||
it "returns status 404" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -166,7 +166,7 @@ describe Projects::DiscussionsController do
|
|||
end
|
||||
|
||||
it "returns status 404" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -174,13 +174,13 @@ describe Projects::DiscussionsController do
|
|||
|
||||
context "when the discussion is resolvable" do
|
||||
it "unresolves the discussion" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(note.reload.discussion.resolved?).to be false
|
||||
end
|
||||
|
||||
it "returns status 200" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -194,7 +194,7 @@ describe Projects::DiscussionsController do
|
|||
expect_any_instance_of(DiscussionSerializer).to receive(:represent)
|
||||
.with(instance_of(Discussion), { context: instance_of(described_class), render_truncated_diff_lines: true })
|
||||
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Projects::EnvironmentsController do
|
|||
describe 'GET index' do
|
||||
context 'when a request for the HTML is made' do
|
||||
it 'responds with status code 200' do
|
||||
get :index, environment_params
|
||||
get :index, params: environment_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
end
|
||||
|
|
@ -26,7 +26,7 @@ describe Projects::EnvironmentsController do
|
|||
expect_any_instance_of(Gitlab::EtagCaching::Store)
|
||||
.to receive(:touch).with(project_environments_path(project, format: :json))
|
||||
|
||||
get :index, environment_params
|
||||
get :index, params: environment_params
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
context 'when requesting available environments scope' do
|
||||
before do
|
||||
get :index, environment_params(format: :json, scope: :available)
|
||||
get :index, params: environment_params(format: :json, scope: :available)
|
||||
end
|
||||
|
||||
it 'responds with a payload describing available environments' do
|
||||
|
|
@ -73,7 +73,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
context 'when requesting stopped environments scope' do
|
||||
before do
|
||||
get :index, environment_params(format: :json, scope: :stopped)
|
||||
get :index, params: environment_params(format: :json, scope: :stopped)
|
||||
end
|
||||
|
||||
it 'responds with a payload describing stopped environments' do
|
||||
|
|
@ -103,9 +103,11 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
context 'when using default format' do
|
||||
it 'responds with HTML' do
|
||||
get :folder, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: 'staging-1.0'
|
||||
get :folder, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: 'staging-1.0'
|
||||
}
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(response).to render_template 'folder'
|
||||
|
|
@ -114,9 +116,11 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
context 'when using JSON format' do
|
||||
it 'sorts the subfolders lexicographically' do
|
||||
get :folder, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: 'staging-1.0',
|
||||
get :folder, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: 'staging-1.0'
|
||||
},
|
||||
format: :json
|
||||
|
||||
expect(response).to be_ok
|
||||
|
|
@ -132,7 +136,7 @@ describe Projects::EnvironmentsController do
|
|||
describe 'GET show' do
|
||||
context 'with valid id' do
|
||||
it 'responds with a status code 200' do
|
||||
get :show, environment_params
|
||||
get :show, params: environment_params
|
||||
|
||||
expect(response).to be_ok
|
||||
end
|
||||
|
|
@ -142,7 +146,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'responds with a status code 404' do
|
||||
params = environment_params
|
||||
params[:id] = 12345
|
||||
get :show, params
|
||||
get :show, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -151,7 +155,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
describe 'GET edit' do
|
||||
it 'responds with a status code 200' do
|
||||
get :edit, environment_params
|
||||
get :edit, params: environment_params
|
||||
|
||||
expect(response).to be_ok
|
||||
end
|
||||
|
|
@ -160,7 +164,7 @@ describe Projects::EnvironmentsController do
|
|||
describe 'PATCH #update' do
|
||||
it 'responds with a 302' do
|
||||
patch_params = environment_params.merge(environment: { external_url: 'https://git.gitlab.com' })
|
||||
patch :update, patch_params
|
||||
patch :update, params: patch_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -171,7 +175,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'returns 404' do
|
||||
allow_any_instance_of(Environment).to receive(:available?) { false }
|
||||
|
||||
patch :stop, environment_params(format: :json)
|
||||
patch :stop, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -184,7 +188,7 @@ describe Projects::EnvironmentsController do
|
|||
allow_any_instance_of(Environment)
|
||||
.to receive_messages(available?: true, stop_with_action!: action)
|
||||
|
||||
patch :stop, environment_params(format: :json)
|
||||
patch :stop, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response).to eq(
|
||||
|
|
@ -198,7 +202,7 @@ describe Projects::EnvironmentsController do
|
|||
allow_any_instance_of(Environment)
|
||||
.to receive_messages(available?: true, stop_with_action!: nil)
|
||||
|
||||
patch :stop, environment_params(format: :json)
|
||||
patch :stop, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response).to eq(
|
||||
|
|
@ -211,7 +215,7 @@ describe Projects::EnvironmentsController do
|
|||
describe 'GET #terminal' do
|
||||
context 'with valid id' do
|
||||
it 'responds with a status code 200' do
|
||||
get :terminal, environment_params
|
||||
get :terminal, params: environment_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -222,13 +226,13 @@ describe Projects::EnvironmentsController do
|
|||
expect_any_instance_of(defined?(EE) ? EE::Environment : Environment)
|
||||
.to receive(:terminals)
|
||||
|
||||
get :terminal, environment_params
|
||||
get :terminal, params: environment_params
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid id' do
|
||||
it 'responds with a status code 404' do
|
||||
get :terminal, environment_params(id: 666)
|
||||
get :terminal, params: environment_params(id: 666)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -254,7 +258,7 @@ describe Projects::EnvironmentsController do
|
|||
.with(:fake_terminal)
|
||||
.and_return(workhorse: :response)
|
||||
|
||||
get :terminal_websocket_authorize, environment_params
|
||||
get :terminal_websocket_authorize, params: environment_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response.headers["Content-Type"]).to eq(Gitlab::Workhorse::INTERNAL_API_CONTENT_TYPE)
|
||||
|
|
@ -264,7 +268,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
context 'and invalid id' do
|
||||
it 'returns 404' do
|
||||
get :terminal_websocket_authorize, environment_params(id: 666)
|
||||
get :terminal_websocket_authorize, params: environment_params(id: 666)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -275,7 +279,7 @@ describe Projects::EnvironmentsController do
|
|||
it 'aborts with an exception' do
|
||||
allow(Gitlab::Workhorse).to receive(:verify_api_request!).and_raise(JWT::DecodeError)
|
||||
|
||||
expect { get :terminal_websocket_authorize, environment_params }.to raise_error(JWT::DecodeError)
|
||||
expect { get :terminal_websocket_authorize, params: environment_params }.to raise_error(JWT::DecodeError)
|
||||
# controller tests don't set the response status correctly. It's enough
|
||||
# to check that the action raised an exception
|
||||
end
|
||||
|
|
@ -288,13 +292,13 @@ describe Projects::EnvironmentsController do
|
|||
it 'redirects to environment if it exists' do
|
||||
environment = create(:environment, name: 'production', project: project)
|
||||
|
||||
get :metrics_redirect, namespace_id: project.namespace, project_id: project
|
||||
get :metrics_redirect, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to redirect_to(environment_metrics_path(environment))
|
||||
end
|
||||
|
||||
it 'redirects to empty page if no environment exists' do
|
||||
get :metrics_redirect, namespace_id: project.namespace, project_id: project
|
||||
get :metrics_redirect, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(response).to render_template 'empty'
|
||||
|
|
@ -312,14 +316,14 @@ describe Projects::EnvironmentsController do
|
|||
end
|
||||
|
||||
it 'returns a metrics page' do
|
||||
get :metrics, environment_params
|
||||
get :metrics, params: environment_params
|
||||
|
||||
expect(response).to be_ok
|
||||
end
|
||||
|
||||
context 'when requesting metrics as JSON' do
|
||||
it 'returns a metrics JSON document' do
|
||||
get :metrics, environment_params(format: :json)
|
||||
get :metrics, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(json_response).to eq({})
|
||||
|
|
@ -337,7 +341,7 @@ describe Projects::EnvironmentsController do
|
|||
end
|
||||
|
||||
it 'returns a metrics JSON document' do
|
||||
get :metrics, environment_params(format: :json)
|
||||
get :metrics, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(json_response['success']).to be(true)
|
||||
|
|
@ -359,7 +363,7 @@ describe Projects::EnvironmentsController do
|
|||
|
||||
context 'when requesting metrics as JSON' do
|
||||
it 'returns a metrics JSON document' do
|
||||
get :additional_metrics, environment_params(format: :json)
|
||||
get :additional_metrics, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(204)
|
||||
expect(json_response).to eq({})
|
||||
|
|
@ -379,7 +383,7 @@ describe Projects::EnvironmentsController do
|
|||
end
|
||||
|
||||
it 'returns a metrics JSON document' do
|
||||
get :additional_metrics, environment_params(format: :json)
|
||||
get :additional_metrics, params: environment_params(format: :json)
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(json_response['success']).to be(true)
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@ describe Projects::FindFileController do
|
|||
|
||||
before do
|
||||
get(:show,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id)
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
})
|
||||
end
|
||||
|
||||
context "valid branch" do
|
||||
|
|
@ -36,9 +38,11 @@ describe Projects::FindFileController do
|
|||
describe "GET #list" do
|
||||
def go(format: 'json')
|
||||
get :list,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id,
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: id
|
||||
},
|
||||
format: format
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ describe Projects::ForksController do
|
|||
describe 'GET index' do
|
||||
def get_forks
|
||||
get :index,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
}
|
||||
end
|
||||
|
||||
context 'when fork is public' do
|
||||
|
|
@ -83,8 +85,10 @@ describe Projects::ForksController do
|
|||
describe 'GET new' do
|
||||
def get_new
|
||||
get :new,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
}
|
||||
end
|
||||
|
||||
context 'when user is signed in' do
|
||||
|
|
@ -111,9 +115,11 @@ describe Projects::ForksController do
|
|||
describe 'POST create' do
|
||||
def post_create
|
||||
post :create,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
namespace_key: user.namespace.id
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
namespace_key: user.namespace.id
|
||||
}
|
||||
end
|
||||
|
||||
context 'when user is signed in' do
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Projects::GraphsController do
|
|||
|
||||
describe 'GET languages' do
|
||||
it "redirects_to action charts" do
|
||||
get(:commits, namespace_id: project.namespace.path, project_id: project.path, id: 'master')
|
||||
get(:commits, params: { namespace_id: project.namespace.path, project_id: project.path, id: 'master' })
|
||||
|
||||
expect(response).to redirect_to action: :charts
|
||||
end
|
||||
|
|
@ -19,7 +19,7 @@ describe Projects::GraphsController do
|
|||
|
||||
describe 'GET commits' do
|
||||
it "redirects_to action charts" do
|
||||
get(:commits, namespace_id: project.namespace.path, project_id: project.path, id: 'master')
|
||||
get(:commits, params: { namespace_id: project.namespace.path, project_id: project.path, id: 'master' })
|
||||
|
||||
expect(response).to redirect_to action: :charts
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,10 +14,12 @@ describe Projects::GroupLinksController do
|
|||
describe '#create' do
|
||||
shared_context 'link project to group' do
|
||||
before do
|
||||
post(:create, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
link_group_id: group.id,
|
||||
link_group_access: ProjectGroupLink.default_access)
|
||||
post(:create, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
link_group_id: group.id,
|
||||
link_group_access: ProjectGroupLink.default_access
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -65,10 +67,12 @@ describe Projects::GroupLinksController do
|
|||
|
||||
context 'when project group id equal link group id' do
|
||||
before do
|
||||
post(:create, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
link_group_id: group2.id,
|
||||
link_group_access: ProjectGroupLink.default_access)
|
||||
post(:create, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
link_group_id: group2.id,
|
||||
link_group_access: ProjectGroupLink.default_access
|
||||
})
|
||||
end
|
||||
|
||||
it 'does not share project with selected group' do
|
||||
|
|
@ -84,9 +88,11 @@ describe Projects::GroupLinksController do
|
|||
|
||||
context 'when link group id is not present' do
|
||||
before do
|
||||
post(:create, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
link_group_access: ProjectGroupLink.default_access)
|
||||
post(:create, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
link_group_access: ProjectGroupLink.default_access
|
||||
})
|
||||
end
|
||||
|
||||
it 'redirects to project group links page' do
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Projects::HooksController do
|
|||
|
||||
describe '#index' do
|
||||
it 'redirects to settings/integrations page' do
|
||||
get(:index, namespace_id: project.namespace, project_id: project)
|
||||
get(:index, params: { namespace_id: project.namespace, project_id: project })
|
||||
|
||||
expect(response).to redirect_to(
|
||||
project_settings_integrations_path(project)
|
||||
|
|
@ -38,7 +38,7 @@ describe Projects::HooksController do
|
|||
wiki_page_events: true
|
||||
}
|
||||
|
||||
post :create, namespace_id: project.namespace, project_id: project, hook: hook_params
|
||||
post :create, params: { namespace_id: project.namespace, project_id: project, hook: hook_params }
|
||||
|
||||
expect(response).to have_http_status(302)
|
||||
expect(ProjectHook.all.size).to eq(1)
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ describe Projects::ImportsController do
|
|||
describe 'GET #show' do
|
||||
context 'when repository does not exists' do
|
||||
it 'renders template' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to render_template :show
|
||||
end
|
||||
|
||||
it 'sets flash.now if params is present' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'Started' }
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'Started' } }
|
||||
|
||||
expect(flash.now[:notice]).to eq 'Started'
|
||||
end
|
||||
|
|
@ -34,13 +34,13 @@ describe Projects::ImportsController do
|
|||
end
|
||||
|
||||
it 'renders template' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to render_template :show
|
||||
end
|
||||
|
||||
it 'sets flash.now if params is present' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'In progress' }
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'In progress' } }
|
||||
|
||||
expect(flash.now[:notice]).to eq 'In progress'
|
||||
end
|
||||
|
|
@ -52,7 +52,7 @@ describe Projects::ImportsController do
|
|||
end
|
||||
|
||||
it 'redirects to new_namespace_project_import_path' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to redirect_to new_project_import_path(project)
|
||||
end
|
||||
|
|
@ -67,7 +67,7 @@ describe Projects::ImportsController do
|
|||
it 'redirects to namespace_project_path' do
|
||||
allow_any_instance_of(Project).to receive(:forked?).and_return(true)
|
||||
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(flash[:notice]).to eq 'The project was successfully forked.'
|
||||
expect(response).to redirect_to project_path(project)
|
||||
|
|
@ -76,7 +76,7 @@ describe Projects::ImportsController do
|
|||
|
||||
context 'when project is external' do
|
||||
it 'redirects to namespace_project_path' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(flash[:notice]).to eq 'The project was successfully imported.'
|
||||
expect(response).to redirect_to project_path(project)
|
||||
|
|
@ -92,7 +92,7 @@ describe Projects::ImportsController do
|
|||
end
|
||||
|
||||
it 'redirects to internal params[:to]' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project, continue: params
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: params }
|
||||
|
||||
expect(flash[:notice]).to eq params[:notice]
|
||||
expect(response).to redirect_to params[:to]
|
||||
|
|
@ -101,7 +101,7 @@ describe Projects::ImportsController do
|
|||
it 'does not redirect to external params[:to]' do
|
||||
params[:to] = "//google.com"
|
||||
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project, continue: params
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project, continue: params }
|
||||
expect(response).not_to redirect_to params[:to]
|
||||
end
|
||||
end
|
||||
|
|
@ -113,7 +113,7 @@ describe Projects::ImportsController do
|
|||
end
|
||||
|
||||
it 'redirects to namespace_project_path' do
|
||||
get :show, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :show, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to redirect_to project_path(project)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe Projects::IssuesController do
|
|||
project.issues_enabled = false
|
||||
project.save!
|
||||
|
||||
get :index, namespace_id: project.namespace, project_id: project
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -26,7 +26,7 @@ describe Projects::IssuesController do
|
|||
|
||||
context 'when GitLab issues enabled' do
|
||||
it 'renders the "index" template' do
|
||||
get :index, namespace_id: project.namespace, project_id: project
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template(:index)
|
||||
|
|
@ -45,13 +45,13 @@ describe Projects::IssuesController do
|
|||
it_behaves_like 'set sort order from user preference'
|
||||
|
||||
it "returns index" do
|
||||
get :index, namespace_id: project.namespace, project_id: project
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it "returns 301 if request path doesn't match project path" do
|
||||
get :index, namespace_id: project.namespace, project_id: project.path.upcase
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project.path.upcase }
|
||||
|
||||
expect(response).to redirect_to(project_issues_path(project))
|
||||
end
|
||||
|
|
@ -60,7 +60,7 @@ describe Projects::IssuesController do
|
|||
project.issues_enabled = false
|
||||
project.save!
|
||||
|
||||
get :index, namespace_id: project.namespace, project_id: project
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
end
|
||||
|
|
@ -77,18 +77,22 @@ describe Projects::IssuesController do
|
|||
|
||||
it 'redirects to last_page if page number is larger than number of pages' do
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: (last_page + 1).to_param
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: (last_page + 1).to_param
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
|
||||
end
|
||||
|
||||
it 'redirects to specified page' do
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: last_page.to_param
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: last_page.to_param
|
||||
}
|
||||
|
||||
expect(assigns(:issues).current_page).to eq(last_page)
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
@ -97,10 +101,12 @@ describe Projects::IssuesController do
|
|||
it 'does not redirect to external sites when provided a host field' do
|
||||
external_host = "www.example.com"
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: (last_page + 1).to_param,
|
||||
host: external_host
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: (last_page + 1).to_param,
|
||||
host: external_host
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
|
||||
end
|
||||
|
|
@ -109,9 +115,11 @@ describe Projects::IssuesController do
|
|||
allow(controller).to receive(:pagination_disabled?).and_return(true)
|
||||
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: (last_page + 1).to_param
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
page: (last_page + 1).to_param
|
||||
}
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(assigns(:issues).size).to eq(2)
|
||||
|
|
@ -121,7 +129,7 @@ describe Projects::IssuesController do
|
|||
|
||||
describe 'GET #new' do
|
||||
it 'redirects to signin if not logged in' do
|
||||
get :new, namespace_id: project.namespace, project_id: project
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(flash[:notice]).to eq 'Please sign in to create the new issue.'
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
|
|
@ -134,7 +142,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it 'builds a new issue' do
|
||||
get :new, namespace_id: project.namespace, project_id: project
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(assigns(:issue)).to be_a_new(Issue)
|
||||
end
|
||||
|
|
@ -144,7 +152,7 @@ describe Projects::IssuesController do
|
|||
project_with_repository.add_developer(user)
|
||||
mr = create(:merge_request_with_diff_notes, source_project: project_with_repository)
|
||||
|
||||
get :new, namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_to_resolve_discussions_of: mr.iid
|
||||
get :new, params: { namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_to_resolve_discussions_of: mr.iid }
|
||||
|
||||
expect(assigns(:issue).title).not_to be_empty
|
||||
expect(assigns(:issue).description).not_to be_empty
|
||||
|
|
@ -153,7 +161,7 @@ describe Projects::IssuesController do
|
|||
it 'fills in an issue for a discussion' do
|
||||
note = create(:note_on_merge_request, project: project)
|
||||
|
||||
get :new, namespace_id: project.namespace.path, project_id: project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id
|
||||
get :new, params: { namespace_id: project.namespace.path, project_id: project, merge_request_to_resolve_discussions_of: note.noteable.iid, discussion_to_resolve: note.discussion_id }
|
||||
|
||||
expect(assigns(:issue).title).not_to be_empty
|
||||
expect(assigns(:issue).description).not_to be_empty
|
||||
|
|
@ -178,7 +186,7 @@ describe Projects::IssuesController do
|
|||
project.issues_enabled = false
|
||||
project.save!
|
||||
|
||||
get :new, namespace_id: project.namespace, project_id: project
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -186,7 +194,7 @@ describe Projects::IssuesController do
|
|||
|
||||
context 'when GitLab issues enabled' do
|
||||
it 'renders the "new" template' do
|
||||
get :new, namespace_id: project.namespace, project_id: project
|
||||
get :new, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template(:new)
|
||||
|
|
@ -212,9 +220,11 @@ describe Projects::IssuesController do
|
|||
context 'without an AJAX request' do
|
||||
it 'stores the visited URL' do
|
||||
get :show,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: issue.iid
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: issue.iid
|
||||
}
|
||||
|
||||
expect(session['user_return_to']).to eq("/#{project.namespace.to_param}/#{project.to_param}/issues/#{issue.iid}")
|
||||
end
|
||||
|
|
@ -253,11 +263,13 @@ describe Projects::IssuesController do
|
|||
|
||||
def move_issue
|
||||
post :move,
|
||||
format: :json,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: issue.iid,
|
||||
move_to_project_id: another_project.id
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: issue.iid,
|
||||
move_to_project_id: another_project.id
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -265,10 +277,13 @@ describe Projects::IssuesController do
|
|||
describe 'PUT #update' do
|
||||
subject do
|
||||
put :update,
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: issue.to_param,
|
||||
issue: { title: 'New title' }, format: :json
|
||||
params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: issue.to_param,
|
||||
issue: { title: 'New title' }
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
@ -318,9 +333,11 @@ describe Projects::IssuesController do
|
|||
describe 'GET #realtime_changes' do
|
||||
def go(id:)
|
||||
get :realtime_changes,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
}
|
||||
end
|
||||
|
||||
context 'when an issue was edited' do
|
||||
|
|
@ -433,8 +450,10 @@ describe Projects::IssuesController do
|
|||
|
||||
def get_issues
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -502,7 +521,7 @@ describe Projects::IssuesController do
|
|||
format: :json
|
||||
}.merge(additional_params)
|
||||
|
||||
put :update, params
|
||||
put :update, params: params
|
||||
end
|
||||
|
||||
def go(id:)
|
||||
|
|
@ -635,9 +654,11 @@ describe Projects::IssuesController do
|
|||
|
||||
def go(id:)
|
||||
get :show,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
}
|
||||
end
|
||||
|
||||
it 'avoids (most) N+1s loading labels', :request_store do
|
||||
|
|
@ -658,9 +679,11 @@ describe Projects::IssuesController do
|
|||
|
||||
def go(id:)
|
||||
get :realtime_changes,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -669,9 +692,11 @@ describe Projects::IssuesController do
|
|||
|
||||
def go(id:)
|
||||
get :edit,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -680,10 +705,12 @@ describe Projects::IssuesController do
|
|||
|
||||
def go(id:)
|
||||
put :update,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id,
|
||||
issue: { title: 'New title' }
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: id,
|
||||
issue: { title: 'New title' }
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -694,7 +721,7 @@ describe Projects::IssuesController do
|
|||
project = create(:project, :public)
|
||||
project.add_developer(user)
|
||||
|
||||
post :create, {
|
||||
post :create, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
issue: { title: 'Title', description: 'Description' }.merge(issue_attrs)
|
||||
|
|
@ -718,7 +745,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
def post_issue(issue_params, other_params: {})
|
||||
post :create, { namespace_id: project.namespace.to_param, project_id: project, issue: issue_params, merge_request_to_resolve_discussions_of: merge_request.iid }.merge(other_params)
|
||||
post :create, params: { namespace_id: project.namespace.to_param, project_id: project, issue: issue_params, merge_request_to_resolve_discussions_of: merge_request.iid }.merge(other_params)
|
||||
end
|
||||
|
||||
it 'creates an issue for the project' do
|
||||
|
|
@ -885,7 +912,7 @@ describe Projects::IssuesController do
|
|||
create(:user_agent_detail, subject: issue)
|
||||
project.add_maintainer(admin)
|
||||
sign_in(admin)
|
||||
post :mark_as_spam, {
|
||||
post :mark_as_spam, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: issue.iid
|
||||
|
|
@ -906,7 +933,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it "rejects a developer to destroy an issue" do
|
||||
delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
end
|
||||
|
|
@ -921,7 +948,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it "deletes the issue" do
|
||||
delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./)
|
||||
|
|
@ -930,7 +957,7 @@ describe Projects::IssuesController do
|
|||
it 'delegates the update of the todos count cache to TodoService' do
|
||||
expect_any_instance_of(TodoService).to receive(:destroy_target).with(issue).once
|
||||
|
||||
delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -943,8 +970,12 @@ describe Projects::IssuesController do
|
|||
|
||||
it "toggles the award emoji" do
|
||||
expect do
|
||||
post(:toggle_award_emoji, namespace_id: project.namespace,
|
||||
project_id: project, id: issue.iid, name: "thumbsup")
|
||||
post(:toggle_award_emoji, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: issue.iid,
|
||||
name: "thumbsup"
|
||||
})
|
||||
end.to change { issue.award_emoji.count }.by(1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
@ -986,9 +1017,11 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
def create_merge_request
|
||||
post :create_merge_request, namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
id: issue.to_param,
|
||||
post :create_merge_request, params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project.to_param,
|
||||
id: issue.to_param
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -1002,7 +1035,7 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it 'returns discussion json' do
|
||||
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
|
||||
expect(json_response.first.keys).to match_array(%w[id reply_id expanded notes diff_discussion discussion_path individual_note resolvable resolved resolved_at resolved_by resolved_by_push commit_id for_commit project_id])
|
||||
end
|
||||
|
|
@ -1010,7 +1043,7 @@ describe Projects::IssuesController do
|
|||
it 'renders the author status html if there is a status' do
|
||||
create(:user_status, user: discussion.author)
|
||||
|
||||
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
|
||||
note_json = json_response.first['notes'].first
|
||||
|
||||
|
|
@ -1019,14 +1052,14 @@ describe Projects::IssuesController do
|
|||
|
||||
it 'does not cause an extra query for the status' do
|
||||
control = ActiveRecord::QueryRecorder.new do
|
||||
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
end
|
||||
|
||||
create(:user_status, user: discussion.author)
|
||||
second_discussion = create(:discussion_note_on_issue, noteable: issue, project: issue.project, author: create(:user))
|
||||
create(:user_status, user: second_discussion.author)
|
||||
|
||||
expect { get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
expect { get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } }
|
||||
.not_to exceed_query_limit(control)
|
||||
end
|
||||
|
||||
|
|
@ -1046,26 +1079,26 @@ describe Projects::IssuesController do
|
|||
end
|
||||
|
||||
it 'filters notes that the user should not see' do
|
||||
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
|
||||
expect(JSON.parse(response.body).count).to eq(1)
|
||||
end
|
||||
|
||||
it 'does not result in N+1 queries' do
|
||||
# Instantiate the controller variables to ensure QueryRecorder has an accurate base count
|
||||
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
|
||||
RequestStore.clear!
|
||||
|
||||
control_count = ActiveRecord::QueryRecorder.new do
|
||||
get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid
|
||||
get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid }
|
||||
end.count
|
||||
|
||||
RequestStore.clear!
|
||||
|
||||
create_list(:discussion_note_on_issue, 2, :system, noteable: issue, project: issue.project, note: cross_reference)
|
||||
|
||||
expect { get :discussions, namespace_id: project.namespace, project_id: project, id: issue.iid }.not_to exceed_query_limit(control_count)
|
||||
expect { get :discussions, params: { namespace_id: project.namespace, project_id: project, id: issue.iid } }.not_to exceed_query_limit(control_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :index, params.merge(extra_params)
|
||||
get :index, params: params.merge(extra_params)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -461,7 +461,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :show, params.merge(extra_params)
|
||||
get :show, params: params.merge(extra_params)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -552,9 +552,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def get_trace
|
||||
get :trace, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id,
|
||||
get :trace, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -564,9 +566,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
let(:status) { job.detailed_status(double('user')) }
|
||||
|
||||
before do
|
||||
get :status, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id,
|
||||
get :status, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
|
|
@ -605,9 +609,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def post_retry
|
||||
post :retry, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
post :retry, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -645,9 +651,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def post_play
|
||||
post :play, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
post :play, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -714,9 +722,9 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def post_cancel(additional_params = {})
|
||||
post :cancel, { namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id }.merge(additional_params)
|
||||
post :cancel, params: { namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id }.merge(additional_params)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -754,9 +762,11 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def post_unschedule
|
||||
post :unschedule, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
post :unschedule, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -797,8 +807,10 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def post_cancel_all
|
||||
post :cancel_all, namespace_id: project.namespace,
|
||||
project_id: project
|
||||
post :cancel_all, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -860,17 +872,21 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
end
|
||||
|
||||
def post_erase
|
||||
post :erase, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
post :erase, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET raw' do
|
||||
subject do
|
||||
post :raw, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
post :raw, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: job.id
|
||||
}
|
||||
end
|
||||
|
||||
context "when job has a trace artifact" do
|
||||
|
|
@ -1020,7 +1036,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :terminal, params.merge(extra_params)
|
||||
get :terminal, params: params.merge(extra_params)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1074,7 +1090,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
|
|||
project_id: project
|
||||
}
|
||||
|
||||
get :terminal_websocket_authorize, params.merge(extra_params)
|
||||
get :terminal_websocket_authorize, params: params.merge(extra_params)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ describe Projects::LabelsController do
|
|||
end
|
||||
|
||||
def list_labels
|
||||
get :index, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :index, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ describe Projects::LabelsController do
|
|||
let(:personal_project) { create(:project, namespace: user.namespace) }
|
||||
|
||||
it 'creates labels' do
|
||||
post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project
|
||||
post :generate, params: { namespace_id: personal_project.namespace.to_param, project_id: personal_project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -84,7 +84,7 @@ describe Projects::LabelsController do
|
|||
|
||||
context 'project belonging to a group' do
|
||||
it 'creates labels' do
|
||||
post :generate, namespace_id: project.namespace.to_param, project_id: project
|
||||
post :generate, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -109,7 +109,7 @@ describe Projects::LabelsController do
|
|||
end
|
||||
|
||||
def toggle_subscription(label)
|
||||
post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project, id: label.to_param
|
||||
post :toggle_subscription, params: { namespace_id: project.namespace.to_param, project_id: project, id: label.to_param }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ describe Projects::LabelsController do
|
|||
|
||||
context 'not group reporters' do
|
||||
it 'denies access' do
|
||||
post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
|
||||
post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -131,13 +131,13 @@ describe Projects::LabelsController do
|
|||
end
|
||||
|
||||
it 'gives access' do
|
||||
post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
|
||||
post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
|
||||
|
||||
expect(response).to redirect_to(namespace_project_labels_path)
|
||||
end
|
||||
|
||||
it 'promotes the label' do
|
||||
post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
|
||||
post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
|
||||
|
||||
expect(Label.where(id: label_1.id)).to be_empty
|
||||
expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil
|
||||
|
|
@ -146,7 +146,7 @@ describe Projects::LabelsController do
|
|||
it 'renders label name without parsing it as HTML' do
|
||||
label_1.update!(name: 'CCC<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<img src=x onerror=alert(document.domain)> promoted to <a href=\"#{group_labels_path(project.group)}\"><u>group label</u></a>.")
|
||||
end
|
||||
|
|
@ -159,7 +159,7 @@ describe Projects::LabelsController do
|
|||
end
|
||||
|
||||
it 'returns to label list' do
|
||||
post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param
|
||||
post :promote, params: { namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param }
|
||||
expect(response).to redirect_to(namespace_project_labels_path)
|
||||
end
|
||||
end
|
||||
|
|
@ -176,7 +176,7 @@ describe Projects::LabelsController do
|
|||
context 'non-show path' do
|
||||
context 'with exactly matching casing' do
|
||||
it 'does not redirect' do
|
||||
get :index, namespace_id: project.namespace, project_id: project.to_param
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project.to_param }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -184,7 +184,7 @@ describe Projects::LabelsController do
|
|||
|
||||
context 'with different casing' do
|
||||
it 'redirects to the correct casing' do
|
||||
get :index, namespace_id: project.namespace, project_id: project.to_param.upcase
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project.to_param.upcase }
|
||||
|
||||
expect(response).to redirect_to(project_labels_path(project))
|
||||
expect(controller).not_to set_flash[:notice]
|
||||
|
|
@ -197,7 +197,7 @@ describe Projects::LabelsController do
|
|||
let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') }
|
||||
|
||||
it 'redirects to the canonical path' do
|
||||
get :index, namespace_id: project.namespace, project_id: project.to_param + 'old'
|
||||
get :index, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }
|
||||
|
||||
expect(response).to redirect_to(project_labels_path(project))
|
||||
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project))
|
||||
|
|
@ -209,13 +209,13 @@ describe Projects::LabelsController do
|
|||
context 'for a non-GET request' do
|
||||
context 'when requesting the canonical path with different casing' do
|
||||
it 'does not 404' do
|
||||
post :generate, namespace_id: project.namespace, project_id: project
|
||||
post :generate, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'does not redirect to the correct casing' do
|
||||
post :generate, namespace_id: project.namespace, project_id: project
|
||||
post :generate, params: { namespace_id: project.namespace, project_id: project }
|
||||
|
||||
expect(response).not_to have_gitlab_http_status(301)
|
||||
end
|
||||
|
|
@ -225,7 +225,7 @@ describe Projects::LabelsController do
|
|||
let!(:redirect_route) { project.redirect_routes.create(path: project.full_path + 'old') }
|
||||
|
||||
it 'returns not found' do
|
||||
post :generate, namespace_id: project.namespace, project_id: project.to_param + 'old'
|
||||
post :generate, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@ describe Projects::MattermostsController do
|
|||
|
||||
it 'accepts the request' do
|
||||
get(:new,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project)
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project
|
||||
})
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -29,9 +31,11 @@ describe Projects::MattermostsController do
|
|||
|
||||
subject do
|
||||
post(:create,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
mattermost: mattermost_params)
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
mattermost: mattermost_params
|
||||
})
|
||||
end
|
||||
|
||||
context 'no request can be made to mattermost' do
|
||||
|
|
|
|||
|
|
@ -21,9 +21,11 @@ describe Projects::MergeRequests::ConflictsController do
|
|||
.and_raise(Gitlab::Git::Conflict::Parser::UnmergeableFile)
|
||||
|
||||
get :show,
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid,
|
||||
params: {
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid
|
||||
},
|
||||
format: 'json'
|
||||
end
|
||||
|
||||
|
|
@ -39,9 +41,11 @@ describe Projects::MergeRequests::ConflictsController do
|
|||
context 'with valid conflicts' do
|
||||
before do
|
||||
get :show,
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid,
|
||||
params: {
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid
|
||||
},
|
||||
format: 'json'
|
||||
end
|
||||
|
||||
|
|
@ -99,11 +103,13 @@ describe Projects::MergeRequests::ConflictsController do
|
|||
describe 'GET conflict_for_path' do
|
||||
def conflict_for_path(path)
|
||||
get :conflict_for_path,
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid,
|
||||
old_path: path,
|
||||
new_path: path,
|
||||
params: {
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid,
|
||||
old_path: path,
|
||||
new_path: path
|
||||
},
|
||||
format: 'json'
|
||||
end
|
||||
|
||||
|
|
@ -160,12 +166,14 @@ describe Projects::MergeRequests::ConflictsController do
|
|||
|
||||
def resolve_conflicts(files)
|
||||
post :resolve_conflicts,
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid,
|
||||
format: 'json',
|
||||
files: files,
|
||||
commit_message: 'Commit message'
|
||||
params: {
|
||||
namespace_id: merge_request_with_conflicts.project.namespace.to_param,
|
||||
project_id: merge_request_with_conflicts.project,
|
||||
id: merge_request_with_conflicts.iid,
|
||||
files: files,
|
||||
commit_message: 'Commit message'
|
||||
},
|
||||
format: 'json'
|
||||
end
|
||||
|
||||
context 'with valid params' do
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ describe Projects::MergeRequests::CreationsController do
|
|||
describe 'GET new' do
|
||||
context 'merge request that removes a submodule' do
|
||||
it 'renders new merge request widget template' do
|
||||
get :new, get_diff_params
|
||||
get :new, params: get_diff_params
|
||||
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
|
@ -52,7 +52,7 @@ describe Projects::MergeRequests::CreationsController do
|
|||
end
|
||||
|
||||
it 'limits total commits' do
|
||||
get :new, large_diff_params
|
||||
get :new, params: large_diff_params
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ describe Projects::MergeRequests::CreationsController do
|
|||
end
|
||||
|
||||
it 'shows total commits' do
|
||||
get :new, large_diff_params
|
||||
get :new, params: large_diff_params
|
||||
|
||||
expect(response).to be_success
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ describe Projects::MergeRequests::CreationsController do
|
|||
it 'does not assign diffs var' do
|
||||
allow_any_instance_of(MergeRequest).to receive(:can_be_created).and_return(false)
|
||||
|
||||
get :diffs, get_diff_params.merge(format: 'json')
|
||||
get :diffs, params: get_diff_params.merge(format: 'json')
|
||||
|
||||
expect(response).to be_success
|
||||
expect(assigns[:diffs]).to be_nil
|
||||
|
|
@ -101,7 +101,7 @@ describe Projects::MergeRequests::CreationsController do
|
|||
end
|
||||
|
||||
it 'renders JSON including serialized pipelines' do
|
||||
get :pipelines, get_diff_params.merge(format: 'json')
|
||||
get :pipelines, params: get_diff_params.merge(format: 'json')
|
||||
|
||||
expect(response).to be_ok
|
||||
expect(json_response).to have_key 'pipelines'
|
||||
|
|
@ -117,7 +117,7 @@ describe Projects::MergeRequests::CreationsController do
|
|||
format: 'json'
|
||||
}
|
||||
|
||||
get :diff_for_path, params.merge(extra_params)
|
||||
get :diff_for_path, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
let(:existing_path) { 'files/ruby/feature.rb' }
|
||||
|
|
@ -184,10 +184,12 @@ describe Projects::MergeRequests::CreationsController do
|
|||
expect(Ability).to receive(:allowed?).with(user, :read_project, project) { true }
|
||||
|
||||
get :branch_to,
|
||||
namespace_id: fork_project.namespace,
|
||||
project_id: fork_project,
|
||||
target_project_id: project.id,
|
||||
ref: 'master'
|
||||
params: {
|
||||
namespace_id: fork_project.namespace,
|
||||
project_id: fork_project,
|
||||
target_project_id: project.id,
|
||||
ref: 'master'
|
||||
}
|
||||
|
||||
expect(assigns(:commit)).not_to be_nil
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
@ -197,10 +199,12 @@ describe Projects::MergeRequests::CreationsController do
|
|||
expect(Ability).to receive(:allowed?).with(user, :read_project, project) { false }
|
||||
|
||||
get :branch_to,
|
||||
namespace_id: fork_project.namespace,
|
||||
project_id: fork_project,
|
||||
target_project_id: project.id,
|
||||
ref: 'master'
|
||||
params: {
|
||||
namespace_id: fork_project.namespace,
|
||||
project_id: fork_project,
|
||||
target_project_id: project.id,
|
||||
ref: 'master'
|
||||
}
|
||||
|
||||
expect(assigns(:commit)).to be_nil
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ describe Projects::MergeRequests::DiffsController do
|
|||
format: 'json'
|
||||
}
|
||||
|
||||
get :show, params.merge(extra_params)
|
||||
get :show, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
context 'with default params' do
|
||||
|
|
@ -89,7 +89,7 @@ describe Projects::MergeRequests::DiffsController do
|
|||
format: 'json'
|
||||
}
|
||||
|
||||
get :diff_for_path, params.merge(extra_params)
|
||||
get :diff_for_path, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
let(:existing_path) { 'files/ruby/popen.rb' }
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@ describe Projects::MergeRequestsController do
|
|||
describe 'GET commit_change_content' do
|
||||
it 'renders commit_change_content template' do
|
||||
get :commit_change_content,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
},
|
||||
format: 'html'
|
||||
|
||||
expect(response).to render_template('_commit_change_content')
|
||||
|
|
@ -31,9 +33,11 @@ describe Projects::MergeRequestsController do
|
|||
shared_examples "loads labels" do |action|
|
||||
it "loads labels into the @labels variable" do
|
||||
get action,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
},
|
||||
format: 'html'
|
||||
expect(assigns(:labels)).not_to be_nil
|
||||
end
|
||||
|
|
@ -47,7 +51,7 @@ describe Projects::MergeRequestsController do
|
|||
id: merge_request.iid
|
||||
}
|
||||
|
||||
get :show, params.merge(extra_params)
|
||||
get :show, params: params.merge(extra_params)
|
||||
end
|
||||
|
||||
it_behaves_like "loads labels", :show
|
||||
|
|
@ -153,9 +157,12 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
def get_merge_requests(page = nil)
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
state: 'opened', page: page.to_param
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
state: 'opened',
|
||||
page: page.to_param
|
||||
}
|
||||
end
|
||||
|
||||
it_behaves_like "issuables list meta-data", :merge_request
|
||||
|
|
@ -182,11 +189,13 @@ describe Projects::MergeRequestsController do
|
|||
it 'does not redirect to external sites when provided a host field' do
|
||||
external_host = "www.example.com"
|
||||
get :index,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
state: 'opened',
|
||||
page: (last_page + 1).to_param,
|
||||
host: external_host
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
state: 'opened',
|
||||
page: (last_page + 1).to_param,
|
||||
host: external_host
|
||||
}
|
||||
|
||||
expect(response).to redirect_to(namespace_project_merge_requests_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope]))
|
||||
end
|
||||
|
|
@ -227,7 +236,7 @@ describe Projects::MergeRequestsController do
|
|||
merge_request: mr_params
|
||||
}.merge(additional_params)
|
||||
|
||||
put :update, params
|
||||
put :update, params: params
|
||||
end
|
||||
|
||||
context 'changing the assignee' do
|
||||
|
|
@ -324,7 +333,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
before do
|
||||
project.add_reporter(user)
|
||||
xhr :post, :merge, base_params
|
||||
xhr :post, :merge, params: base_params
|
||||
end
|
||||
|
||||
it 'returns 404' do
|
||||
|
|
@ -336,7 +345,7 @@ describe Projects::MergeRequestsController do
|
|||
before do
|
||||
merge_request.update(title: "WIP: #{merge_request.title}")
|
||||
|
||||
post :merge, base_params
|
||||
post :merge, params: base_params
|
||||
end
|
||||
|
||||
it 'returns :failed' do
|
||||
|
|
@ -346,7 +355,7 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
context 'when the sha parameter does not match the source SHA' do
|
||||
before do
|
||||
post :merge, base_params.merge(sha: 'foo')
|
||||
post :merge, params: base_params.merge(sha: 'foo')
|
||||
end
|
||||
|
||||
it 'returns :sha_mismatch' do
|
||||
|
|
@ -396,7 +405,7 @@ describe Projects::MergeRequestsController do
|
|||
end
|
||||
|
||||
def merge_when_pipeline_succeeds
|
||||
post :merge, base_params.merge(sha: merge_request.diff_head_sha, merge_when_pipeline_succeeds: '1')
|
||||
post :merge, params: base_params.merge(sha: merge_request.diff_head_sha, merge_when_pipeline_succeeds: '1')
|
||||
end
|
||||
|
||||
it 'returns :merge_when_pipeline_succeeds' do
|
||||
|
|
@ -513,7 +522,7 @@ describe Projects::MergeRequestsController do
|
|||
let(:user) { create(:user) }
|
||||
|
||||
it "denies access to users unless they're admin or project owner" do
|
||||
delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -528,7 +537,7 @@ describe Projects::MergeRequestsController do
|
|||
end
|
||||
|
||||
it "deletes the merge request" do
|
||||
delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./)
|
||||
|
|
@ -537,7 +546,7 @@ describe Projects::MergeRequestsController do
|
|||
it 'delegates the update of the todos count cache to TodoService' do
|
||||
expect_any_instance_of(TodoService).to receive(:destroy_target).with(merge_request).once
|
||||
|
||||
delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid
|
||||
delete :destroy, params: { namespace_id: project.namespace, project_id: project, id: merge_request.iid }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -545,9 +554,11 @@ describe Projects::MergeRequestsController do
|
|||
describe 'GET commits' do
|
||||
def go(format: 'html')
|
||||
get :commits,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
},
|
||||
format: format
|
||||
end
|
||||
|
||||
|
|
@ -566,9 +577,11 @@ describe Projects::MergeRequestsController do
|
|||
sha: merge_request.diff_head_sha)
|
||||
|
||||
get :pipelines,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
|
|
@ -582,9 +595,11 @@ describe Projects::MergeRequestsController do
|
|||
describe 'GET test_reports' do
|
||||
subject do
|
||||
get :test_reports,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid,
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
|
||||
|
|
@ -667,10 +682,12 @@ describe Projects::MergeRequestsController do
|
|||
merge_request.save
|
||||
|
||||
xhr :post, :remove_wip,
|
||||
namespace_id: merge_request.project.namespace.to_param,
|
||||
project_id: merge_request.project,
|
||||
id: merge_request.iid,
|
||||
format: :json
|
||||
format: :json,
|
||||
params: {
|
||||
namespace_id: merge_request.project.namespace.to_param,
|
||||
project_id: merge_request.project,
|
||||
id: merge_request.iid
|
||||
}
|
||||
end
|
||||
|
||||
it 'removes the wip status' do
|
||||
|
|
@ -685,10 +702,12 @@ describe Projects::MergeRequestsController do
|
|||
describe 'POST cancel_merge_when_pipeline_succeeds' do
|
||||
subject do
|
||||
xhr :post, :cancel_merge_when_pipeline_succeeds,
|
||||
namespace_id: merge_request.project.namespace.to_param,
|
||||
project_id: merge_request.project,
|
||||
id: merge_request.iid,
|
||||
format: :json
|
||||
format: :json,
|
||||
params: {
|
||||
namespace_id: merge_request.project.namespace.to_param,
|
||||
project_id: merge_request.project,
|
||||
id: merge_request.iid
|
||||
}
|
||||
end
|
||||
|
||||
it 'calls MergeRequests::MergeWhenPipelineSucceedsService' do
|
||||
|
|
@ -723,9 +742,11 @@ describe Projects::MergeRequestsController do
|
|||
target_branch: 'master')
|
||||
|
||||
post :assign_related_issues,
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
params: {
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
}
|
||||
end
|
||||
|
||||
it 'shows a flash message on success' do
|
||||
|
|
@ -824,7 +845,7 @@ describe Projects::MergeRequestsController do
|
|||
format: 'json'
|
||||
}
|
||||
|
||||
get :ci_environments_status, params.merge(extra_params)
|
||||
get :ci_environments_status, params: params.merge(extra_params)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -865,9 +886,11 @@ describe Projects::MergeRequestsController do
|
|||
end
|
||||
|
||||
def get_pipeline_status
|
||||
get :pipeline_status, namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: merge_request.iid,
|
||||
get :pipeline_status, params: {
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: merge_request.iid
|
||||
},
|
||||
format: :json
|
||||
end
|
||||
end
|
||||
|
|
@ -876,7 +899,7 @@ describe Projects::MergeRequestsController do
|
|||
let(:viewer) { user }
|
||||
|
||||
def post_rebase
|
||||
post :rebase, namespace_id: project.namespace, project_id: project, id: merge_request
|
||||
post :rebase, params: { namespace_id: project.namespace, project_id: project, id: merge_request }
|
||||
end
|
||||
|
||||
def expect_rebase_worker_for(user)
|
||||
|
|
@ -934,13 +957,13 @@ describe Projects::MergeRequestsController do
|
|||
|
||||
describe 'GET edit' do
|
||||
it 'responds successfully' do
|
||||
get :edit, namespace_id: project.namespace, project_id: project, id: merge_request
|
||||
get :edit, params: { namespace_id: project.namespace, project_id: project, id: merge_request }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:success)
|
||||
end
|
||||
|
||||
it 'assigns the noteable to make sure autocompletes work' do
|
||||
get :edit, namespace_id: project.namespace, project_id: project, id: merge_request
|
||||
get :edit, params: { namespace_id: project.namespace, project_id: project, id: merge_request }
|
||||
|
||||
expect(assigns(:noteable)).not_to be_nil
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ describe Projects::MilestonesController do
|
|||
|
||||
def view_milestone(options = {})
|
||||
params = { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
get :show, params.merge(options)
|
||||
get :show, params: params.merge(options)
|
||||
end
|
||||
|
||||
it 'shows milestone page' do
|
||||
|
|
@ -43,9 +43,11 @@ describe Projects::MilestonesController do
|
|||
describe "#index" do
|
||||
context "as html" do
|
||||
def render_index(project:, page:)
|
||||
get :index, namespace_id: project.namespace.id,
|
||||
project_id: project.id,
|
||||
page: page
|
||||
get :index, params: {
|
||||
namespace_id: project.namespace.id,
|
||||
project_id: project.id,
|
||||
page: page
|
||||
}
|
||||
end
|
||||
|
||||
it "queries only projects milestones" do
|
||||
|
|
@ -90,7 +92,7 @@ describe Projects::MilestonesController do
|
|||
context 'with a single group ancestor' do
|
||||
before do
|
||||
project.update(namespace: group)
|
||||
get :index, namespace_id: project.namespace.id, project_id: project.id, format: :json
|
||||
get :index, params: { namespace_id: project.namespace.id, project_id: project.id }, format: :json
|
||||
end
|
||||
|
||||
it "queries projects milestones and groups milestones" do
|
||||
|
|
@ -107,7 +109,7 @@ describe Projects::MilestonesController do
|
|||
|
||||
before do
|
||||
project.update(namespace: subgroup)
|
||||
get :index, namespace_id: project.namespace.id, project_id: project.id, format: :json
|
||||
get :index, params: { namespace_id: project.namespace.id, project_id: project.id }, format: :json
|
||||
end
|
||||
|
||||
it "queries projects milestones and all ancestors milestones" do
|
||||
|
|
@ -124,7 +126,7 @@ describe Projects::MilestonesController do
|
|||
it "removes milestone" do
|
||||
expect(issue.milestone_id).to eq(milestone.id)
|
||||
|
||||
delete :destroy, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid, format: :js
|
||||
delete :destroy, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }, format: :js
|
||||
expect(response).to be_success
|
||||
|
||||
expect(Event.recent.first.action).to eq(Event::DESTROYED)
|
||||
|
|
@ -155,7 +157,7 @@ describe Projects::MilestonesController do
|
|||
end
|
||||
|
||||
it 'renders 404' do
|
||||
post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
|
||||
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -167,7 +169,7 @@ describe Projects::MilestonesController do
|
|||
end
|
||||
|
||||
it 'shows group milestone' do
|
||||
post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
|
||||
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
|
||||
expect(flash[:notice]).to eq("#{milestone.title} promoted to <a href=\"#{group_milestone_path(project.group, milestone.iid)}\"><u>group milestone</u></a>.")
|
||||
expect(response).to redirect_to(project_milestones_path(project))
|
||||
|
|
@ -176,7 +178,7 @@ describe Projects::MilestonesController do
|
|||
it 'renders milestone name without parsing it as HTML' do
|
||||
milestone.update!(name: 'CCC<img src=x onerror=alert(document.domain)>')
|
||||
|
||||
post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
|
||||
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
|
||||
expect(flash[:notice]).to eq("CCC promoted to <a href=\"#{group_milestone_path(project.group, milestone.iid)}\"><u>group milestone</u></a>.")
|
||||
end
|
||||
|
|
@ -190,7 +192,7 @@ describe Projects::MilestonesController do
|
|||
it 'renders 404' do
|
||||
project.update(namespace: user.namespace)
|
||||
|
||||
post :promote, namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid
|
||||
post :promote, params: { namespace_id: project.namespace.id, project_id: project.id, id: milestone.iid }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ describe Projects::MirrorsController do
|
|||
end
|
||||
|
||||
def do_get(project, url = 'ssh://example.com')
|
||||
get :ssh_host_keys, namespace_id: project.namespace, project_id: project, ssh_url: url
|
||||
get :ssh_host_keys, params: { namespace_id: project.namespace, project_id: project, ssh_url: url }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -155,6 +155,6 @@ describe Projects::MirrorsController do
|
|||
attrs = extra_attrs.merge(namespace_id: project.namespace.to_param, project_id: project.to_param)
|
||||
attrs[:project] = options
|
||||
|
||||
put :update, attrs
|
||||
put :update, params: attrs
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ describe Projects::NotesController do
|
|||
.with(anything, anything, hash_including(last_fetched_at: last_fetched_at))
|
||||
.and_call_original
|
||||
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
end
|
||||
|
||||
context 'when user notes_filter is present' do
|
||||
|
|
@ -55,7 +55,7 @@ describe Projects::NotesController do
|
|||
it 'filters system notes by comments' do
|
||||
user.set_notes_filter(UserPreference::NOTES_FILTERS[:only_comments], issue)
|
||||
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
|
||||
expect(notes_json.count).to eq(1)
|
||||
expect(notes_json.first[:id].to_i).to eq(comment.id)
|
||||
|
|
@ -64,7 +64,7 @@ describe Projects::NotesController do
|
|||
it 'returns all notes' do
|
||||
user.set_notes_filter(UserPreference::NOTES_FILTERS[:all_notes], issue)
|
||||
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
|
||||
expect(notes_json.map { |note| note[:id].to_i }).to contain_exactly(comment.id, system_note.id)
|
||||
end
|
||||
|
|
@ -74,7 +74,7 @@ describe Projects::NotesController do
|
|||
|
||||
expect(ResourceEvents::MergeIntoNotesService).not_to receive(:new)
|
||||
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ describe Projects::NotesController do
|
|||
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id, html: true) }
|
||||
|
||||
it 'responds with the expected attributes' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(note_json[:id]).to eq(note.id)
|
||||
expect(note_json[:discussion_html]).not_to be_nil
|
||||
|
|
@ -101,7 +101,7 @@ describe Projects::NotesController do
|
|||
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id, html: true) }
|
||||
|
||||
it 'responds with the expected attributes' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(note_json[:id]).to eq(note.id)
|
||||
expect(note_json[:discussion_html]).not_to be_nil
|
||||
|
|
@ -120,7 +120,7 @@ describe Projects::NotesController do
|
|||
let(:params) { request_params.merge(target_type: 'merge_request', target_id: merge_request.id, html: true) }
|
||||
|
||||
it 'responds with the expected attributes' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(note_json[:id]).to eq(note.id)
|
||||
expect(note_json[:discussion_html]).not_to be_nil
|
||||
|
|
@ -133,7 +133,7 @@ describe Projects::NotesController do
|
|||
let(:params) { request_params.merge(target_type: 'commit', target_id: note.commit_id, html: true) }
|
||||
|
||||
it 'responds with the expected attributes' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(note_json[:id]).to eq(note.id)
|
||||
expect(note_json[:discussion_html]).to be_nil
|
||||
|
|
@ -148,7 +148,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it 'renders 404' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -162,7 +162,7 @@ describe Projects::NotesController do
|
|||
let(:params) { request_params.merge(target_type: 'merge_request', target_id: note.noteable_id, html: true) }
|
||||
|
||||
it 'responds with the expected attributes' do
|
||||
get :index, params
|
||||
get :index, params: params
|
||||
|
||||
expect(note_json[:id]).to eq(note.id)
|
||||
expect(note_json[:html]).not_to be_nil
|
||||
|
|
@ -182,7 +182,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it 'filters notes that the user should not see' do
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
|
||||
expect(parsed_response[:notes].count).to eq(1)
|
||||
expect(note_json[:id]).to eq(note.id.to_s)
|
||||
|
|
@ -190,19 +190,19 @@ describe Projects::NotesController do
|
|||
|
||||
it 'does not result in N+1 queries' do
|
||||
# Instantiate the controller variables to ensure QueryRecorder has an accurate base count
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
|
||||
RequestStore.clear!
|
||||
|
||||
control_count = ActiveRecord::QueryRecorder.new do
|
||||
get :index, request_params
|
||||
get :index, params: request_params
|
||||
end.count
|
||||
|
||||
RequestStore.clear!
|
||||
|
||||
create_list(:discussion_note_on_issue, 2, :system, noteable: issue, project: issue.project, note: cross_reference)
|
||||
|
||||
expect { get :index, request_params }.not_to exceed_query_limit(control_count)
|
||||
expect { get :index, params: request_params }.not_to exceed_query_limit(control_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -227,19 +227,19 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "returns status 302 for html" do
|
||||
post :create, request_params
|
||||
post :create, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
||||
it "returns status 200 for json" do
|
||||
post :create, request_params.merge(format: :json)
|
||||
post :create, params: request_params.merge(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it 'returns discussion JSON when the return_discussion param is set' do
|
||||
post :create, request_params.merge(format: :json, return_discussion: 'true')
|
||||
post :create, params: request_params.merge(format: :json, return_discussion: 'true')
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response).to have_key 'discussion'
|
||||
|
|
@ -260,7 +260,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "returns status 302 for html" do
|
||||
post :create, request_params
|
||||
post :create, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -282,7 +282,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
def post_create(extra_params = {})
|
||||
post :create, {
|
||||
post :create, params: {
|
||||
note: { note: 'some other note', noteable_id: merge_request.id },
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
|
|
@ -342,7 +342,7 @@ describe Projects::NotesController do
|
|||
namespace_id: project.namespace
|
||||
}
|
||||
|
||||
expect { post :create, request_params }.to change { issue.notes.count }.by(1)
|
||||
expect { post :create, params: request_params }.to change { issue.notes.count }.by(1)
|
||||
.and change { locked_issue.notes.count }.by(0)
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -357,7 +357,7 @@ describe Projects::NotesController do
|
|||
context 'when a noteable is not found' do
|
||||
it 'returns 404 status' do
|
||||
request_params[:target_id] = 9999
|
||||
post :create, request_params.merge(format: :json)
|
||||
post :create, params: request_params.merge(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -365,19 +365,19 @@ describe Projects::NotesController do
|
|||
|
||||
context 'when a user is a team member' do
|
||||
it 'returns 302 status for html' do
|
||||
post :create, request_params
|
||||
post :create, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
||||
it 'returns 200 status for json' do
|
||||
post :create, request_params.merge(format: :json)
|
||||
post :create, params: request_params.merge(format: :json)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it 'creates a new note' do
|
||||
expect { post :create, request_params }.to change { Note.count }.by(1)
|
||||
expect { post :create, params: request_params }.to change { Note.count }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -387,13 +387,13 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it 'returns 404 status' do
|
||||
post :create, request_params
|
||||
post :create, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'does not create a new note' do
|
||||
expect { post :create, request_params }.not_to change { Note.count }
|
||||
expect { post :create, params: request_params }.not_to change { Note.count }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -419,7 +419,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "updates the note" do
|
||||
expect { put :update, request_params }.to change { note.reload.note }
|
||||
expect { put :update, params: request_params }.to change { note.reload.note }
|
||||
end
|
||||
end
|
||||
context "doesnt update the note" do
|
||||
|
|
@ -441,7 +441,7 @@ describe Projects::NotesController do
|
|||
note: "New comment"
|
||||
}
|
||||
}
|
||||
expect { put :update, request_params }.not_to change { note.reload.note }
|
||||
expect { put :update, params: request_params }.not_to change { note.reload.note }
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
end
|
||||
|
|
@ -464,13 +464,13 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "returns status 200 for html" do
|
||||
delete :destroy, request_params
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it "deletes the note" do
|
||||
expect { delete :destroy, request_params }.to change { Note.count }.from(1).to(0)
|
||||
expect { delete :destroy, params: request_params }.to change { Note.count }.from(1).to(0)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "returns status 404" do
|
||||
delete :destroy, request_params
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -496,17 +496,17 @@ describe Projects::NotesController do
|
|||
|
||||
it "toggles the award emoji" do
|
||||
expect do
|
||||
post(:toggle_award_emoji, request_params.merge(name: "thumbsup"))
|
||||
post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
|
||||
end.to change { note.award_emoji.count }.by(1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
||||
it "removes the already awarded emoji" do
|
||||
post(:toggle_award_emoji, request_params.merge(name: "thumbsup"))
|
||||
post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
|
||||
|
||||
expect do
|
||||
post(:toggle_award_emoji, request_params.merge(name: "thumbsup"))
|
||||
post(:toggle_award_emoji, params: request_params.merge(name: "thumbsup"))
|
||||
end.to change { AwardEmoji.count }.by(-1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
|
|
@ -525,7 +525,7 @@ describe Projects::NotesController do
|
|||
|
||||
context "when the user is not authorized to resolve the note" do
|
||||
it "returns status 404" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -542,7 +542,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "returns status 404" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -550,7 +550,7 @@ describe Projects::NotesController do
|
|||
|
||||
context "when the note is resolvable" do
|
||||
it "resolves the note" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(note.reload.resolved?).to be true
|
||||
expect(note.reload.resolved_by).to eq(user)
|
||||
|
|
@ -559,17 +559,17 @@ describe Projects::NotesController do
|
|||
it "sends notifications if all discussions are resolved" do
|
||||
expect_any_instance_of(MergeRequests::ResolvedDiscussionNotificationService).to receive(:execute).with(merge_request)
|
||||
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
end
|
||||
|
||||
it "returns the name of the resolving user" do
|
||||
post :resolve, request_params.merge(html: true)
|
||||
post :resolve, params: request_params.merge(html: true)
|
||||
|
||||
expect(JSON.parse(response.body)["resolved_by"]).to eq(user.name)
|
||||
end
|
||||
|
||||
it "returns status 200" do
|
||||
post :resolve, request_params
|
||||
post :resolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -586,7 +586,7 @@ describe Projects::NotesController do
|
|||
|
||||
context "when the user is not authorized to resolve the note" do
|
||||
it "returns status 404" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -603,7 +603,7 @@ describe Projects::NotesController do
|
|||
end
|
||||
|
||||
it "returns status 404" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -611,13 +611,13 @@ describe Projects::NotesController do
|
|||
|
||||
context "when the note is resolvable" do
|
||||
it "unresolves the note" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(note.reload.resolved?).to be false
|
||||
end
|
||||
|
||||
it "returns status 200" do
|
||||
delete :unresolve, request_params
|
||||
delete :unresolve, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ describe Projects::PagesController do
|
|||
|
||||
describe 'GET show' do
|
||||
it 'returns 200 status' do
|
||||
get :show, request_params
|
||||
get :show, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
end
|
||||
|
|
@ -29,7 +29,7 @@ describe Projects::PagesController do
|
|||
let(:project) { create(:project, namespace: group) }
|
||||
|
||||
it 'returns a 404 status code' do
|
||||
get :show, request_params
|
||||
get :show, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -38,7 +38,7 @@ describe Projects::PagesController do
|
|||
|
||||
describe 'DELETE destroy' do
|
||||
it 'returns 302 status' do
|
||||
delete :destroy, request_params
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
end
|
||||
|
|
@ -51,7 +51,7 @@ describe Projects::PagesController do
|
|||
|
||||
describe 'GET show' do
|
||||
it 'returns 404 status' do
|
||||
get :show, request_params
|
||||
get :show, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -59,7 +59,7 @@ describe Projects::PagesController do
|
|||
|
||||
describe 'DELETE destroy' do
|
||||
it 'returns 404 status' do
|
||||
delete :destroy, request_params
|
||||
delete :destroy, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -82,13 +82,13 @@ describe Projects::PagesController do
|
|||
end
|
||||
|
||||
it 'returns 302 status' do
|
||||
patch :update, request_params
|
||||
patch :update, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(:found)
|
||||
end
|
||||
|
||||
it 'redirects back to the pages settings' do
|
||||
patch :update, request_params
|
||||
patch :update, params: request_params
|
||||
|
||||
expect(response).to redirect_to(project_pages_path(project))
|
||||
end
|
||||
|
|
@ -99,7 +99,7 @@ describe Projects::PagesController do
|
|||
.with(project, user, ActionController::Parameters.new(request_params[:project]).permit!)
|
||||
.and_return(update_service)
|
||||
|
||||
patch :update, request_params
|
||||
patch :update, params: request_params
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'GET show' do
|
||||
it "displays the 'show' page" do
|
||||
get(:show, request_params.merge(id: pages_domain.domain))
|
||||
get(:show, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template('show')
|
||||
|
|
@ -33,7 +33,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'GET new' do
|
||||
it "displays the 'new' page" do
|
||||
get(:new, request_params)
|
||||
get(:new, params: request_params)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template('new')
|
||||
|
|
@ -43,7 +43,7 @@ describe Projects::PagesDomainsController do
|
|||
describe 'POST create' do
|
||||
it "creates a new pages domain" do
|
||||
expect do
|
||||
post(:create, request_params.merge(pages_domain: pages_domain_params))
|
||||
post(:create, params: request_params.merge(pages_domain: pages_domain_params))
|
||||
end.to change { PagesDomain.count }.by(1)
|
||||
|
||||
created_domain = PagesDomain.reorder(:id).last
|
||||
|
|
@ -55,7 +55,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'GET edit' do
|
||||
it "displays the 'edit' page" do
|
||||
get(:edit, request_params.merge(id: pages_domain.domain))
|
||||
get(:edit, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(response).to render_template('edit')
|
||||
|
|
@ -81,11 +81,11 @@ describe Projects::PagesDomainsController do
|
|||
.with(ActionController::Parameters.new(pages_domain_params).permit!)
|
||||
.and_return(true)
|
||||
|
||||
patch(:update, params)
|
||||
patch(:update, params: params)
|
||||
end
|
||||
|
||||
it 'redirects to the project page' do
|
||||
patch(:update, params)
|
||||
patch(:update, params: params)
|
||||
|
||||
expect(flash[:notice]).to eq 'Domain was updated'
|
||||
expect(response).to redirect_to(project_pages_path(project))
|
||||
|
|
@ -95,7 +95,7 @@ describe Projects::PagesDomainsController do
|
|||
it 'renders the edit action' do
|
||||
allow(pages_domain).to receive(:update).and_return(false)
|
||||
|
||||
patch(:update, params)
|
||||
patch(:update, params: params)
|
||||
|
||||
expect(response).to render_template('edit')
|
||||
end
|
||||
|
|
@ -108,7 +108,7 @@ describe Projects::PagesDomainsController do
|
|||
.with(hash_not_including(:domain))
|
||||
.and_return(true)
|
||||
|
||||
patch(:update, params.deep_merge(pages_domain: { domain: 'abc' }))
|
||||
patch(:update, params: params.deep_merge(pages_domain: { domain: 'abc' }))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -127,7 +127,7 @@ describe Projects::PagesDomainsController do
|
|||
it 'handles verification success' do
|
||||
expect(stub_service).to receive(:execute).and_return(status: :success)
|
||||
|
||||
post :verify, params
|
||||
post :verify, params: params
|
||||
|
||||
expect(response).to redirect_to project_pages_domain_path(project, pages_domain)
|
||||
expect(flash[:notice]).to eq('Successfully verified domain ownership')
|
||||
|
|
@ -136,14 +136,14 @@ describe Projects::PagesDomainsController do
|
|||
it 'handles verification failure' do
|
||||
expect(stub_service).to receive(:execute).and_return(status: :failed)
|
||||
|
||||
post :verify, params
|
||||
post :verify, params: params
|
||||
|
||||
expect(response).to redirect_to project_pages_domain_path(project, pages_domain)
|
||||
expect(flash[:alert]).to eq('Failed to verify domain ownership')
|
||||
end
|
||||
|
||||
it 'returns a 404 response for an unknown domain' do
|
||||
post :verify, request_params.merge(id: 'unknown-domain')
|
||||
post :verify, params: request_params.merge(id: 'unknown-domain')
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -152,7 +152,7 @@ describe Projects::PagesDomainsController do
|
|||
describe 'DELETE destroy' do
|
||||
it "deletes the pages domain" do
|
||||
expect do
|
||||
delete(:destroy, request_params.merge(id: pages_domain.domain))
|
||||
delete(:destroy, params: request_params.merge(id: pages_domain.domain))
|
||||
end.to change { PagesDomain.count }.by(-1)
|
||||
|
||||
expect(response).to redirect_to(project_pages_path(project))
|
||||
|
|
@ -166,7 +166,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'GET show' do
|
||||
it 'returns 404 status' do
|
||||
get(:show, request_params.merge(id: pages_domain.domain))
|
||||
get(:show, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -174,7 +174,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'GET new' do
|
||||
it 'returns 404 status' do
|
||||
get :new, request_params
|
||||
get :new, params: request_params
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -182,7 +182,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'POST create' do
|
||||
it "returns 404 status" do
|
||||
post(:create, request_params.merge(pages_domain: pages_domain_params))
|
||||
post(:create, params: request_params.merge(pages_domain: pages_domain_params))
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -190,7 +190,7 @@ describe Projects::PagesDomainsController do
|
|||
|
||||
describe 'DELETE destroy' do
|
||||
it "deletes the pages domain" do
|
||||
delete(:destroy, request_params.merge(id: pages_domain.domain))
|
||||
delete(:destroy, params: request_params.merge(id: pages_domain.domain))
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ describe Projects::PipelineSchedulesController do
|
|||
end
|
||||
|
||||
def visit_pipelines_schedules
|
||||
get :index, namespace_id: project.namespace.to_param, project_id: project, scope: scope
|
||||
get :index, params: { namespace_id: project.namespace.to_param, project_id: project, scope: scope }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ describe Projects::PipelineSchedulesController do
|
|||
end
|
||||
|
||||
it 'initializes a pipeline schedule model' do
|
||||
get :new, namespace_id: project.namespace.to_param, project_id: project
|
||||
get :new, params: { namespace_id: project.namespace.to_param, project_id: project }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:schedule)).to be_a_new(Ci::PipelineSchedule)
|
||||
|
|
@ -131,7 +131,7 @@ describe Projects::PipelineSchedulesController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :create, namespace_id: project.namespace.to_param, project_id: project, schedule: schedule
|
||||
post :create, params: { namespace_id: project.namespace.to_param, project_id: project, schedule: schedule }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ describe Projects::PipelineSchedulesController do
|
|||
end
|
||||
|
||||
it 'loads the pipeline schedule' do
|
||||
get :edit, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
get :edit, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(assigns(:schedule)).to eq(pipeline_schedule)
|
||||
|
|
@ -348,7 +348,7 @@ describe Projects::PipelineSchedulesController do
|
|||
end
|
||||
|
||||
def go
|
||||
get :edit, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
get :edit, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -366,7 +366,7 @@ describe Projects::PipelineSchedulesController do
|
|||
end
|
||||
|
||||
def go
|
||||
post :take_ownership, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
post :take_ownership, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ describe Projects::PipelineSchedulesController do
|
|||
it 'does not allow pipeline to be executed' do
|
||||
expect(RunPipelineScheduleWorker).not_to receive(:perform_async)
|
||||
|
||||
post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -398,7 +398,7 @@ describe Projects::PipelineSchedulesController do
|
|||
it 'executes a new pipeline' do
|
||||
expect(RunPipelineScheduleWorker).to receive(:perform_async).with(pipeline_schedule.id, user.id).and_return('job-123')
|
||||
|
||||
post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
|
||||
expect(flash[:notice]).to start_with 'Successfully scheduled a pipeline to run'
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
@ -406,7 +406,7 @@ describe Projects::PipelineSchedulesController do
|
|||
|
||||
it 'prevents users from scheduling the same pipeline repeatedly' do
|
||||
2.times do
|
||||
post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
end
|
||||
|
||||
expect(flash.to_a.size).to eq(2)
|
||||
|
|
@ -422,7 +422,7 @@ describe Projects::PipelineSchedulesController do
|
|||
|
||||
expect(RunPipelineScheduleWorker).not_to receive(:perform_async)
|
||||
|
||||
post :play, namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id
|
||||
post :play, params: { namespace_id: project.namespace.to_param, project_id: project, id: protected_schedule.id }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
|
@ -437,7 +437,7 @@ describe Projects::PipelineSchedulesController do
|
|||
project.add_developer(user)
|
||||
sign_in(user)
|
||||
|
||||
delete :destroy, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
end
|
||||
|
||||
it 'does not delete the pipeline schedule' do
|
||||
|
|
@ -453,7 +453,7 @@ describe Projects::PipelineSchedulesController do
|
|||
|
||||
it 'destroys the pipeline schedule' do
|
||||
expect do
|
||||
delete :destroy, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id
|
||||
delete :destroy, params: { namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id }
|
||||
end.to change { project.pipeline_schedules.count }.by(-1)
|
||||
|
||||
expect(response).to have_gitlab_http_status(302)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue