Skip to content
Snippets Groups Projects
Commit b44a2c80 authored by blackst0ne's avatar blackst0ne
Browse files

Update specs to rails5 format

Updates specs to use new rails5 format.

The old format:
`get :show, { some: params }, { some: headers }`

The new format:
`get :show, params: { some: params }, headers: { some: headers }`
parent 5d68c237
No related branches found
No related tags found
No related merge requests found
Showing
with 146 additions and 123 deletions
Loading
Loading
@@ -8,7 +8,7 @@ require:
- rubocop-rspec
 
AllCops:
TargetRailsVersion: 4.2
TargetRailsVersion: 5.0
Exclude:
- 'vendor/**/*'
- 'node_modules/**/*'
Loading
Loading
---
title: "[Rails5.1] Update functional specs to use new keyword format"
merge_request: 23095
author: "@blackst0ne"
type: other
Loading
Loading
@@ -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.')
Loading
Loading
@@ -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.')
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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))
Loading
Loading
@@ -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))
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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'
Loading
Loading
@@ -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'
Loading
Loading
@@ -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'
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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)
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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) }
Loading
Loading
@@ -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
Loading
Loading
@@ -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) }
Loading
Loading
@@ -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
Loading
Loading
@@ -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'] }
 
Loading
Loading
@@ -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) }
Loading
Loading
@@ -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) }
Loading
Loading
@@ -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) }
Loading
Loading
@@ -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) }
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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'] }
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -153,7 +153,7 @@ describe Boards::IssuesController do
params[:project_id] = project
end
 
get :index, params.compact
get :index, params: params.compact
end
end
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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']
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment