Commit 1535f1ae authored by Thong Kuah's avatar Thong Kuah

Autocorrect LastKeywordArgument for specs

Based on deprecations/ files downloaded from
https://gitlab.com/gitlab-org/gitlab/-/pipelines/220179974
parent 4050f448
......@@ -492,7 +492,7 @@ RSpec.describe EpicsFinder do
let_it_be(:public_epic2) { create(:epic, :confidential, group: public_group1) }
let(:execute_params) { {} }
subject { described_class.new(search_user, group_id: base_group.id).execute(execute_params) }
subject { described_class.new(search_user, group_id: base_group.id).execute(**execute_params) }
it 'returns only public epics' do
expect(subject).to match_array([base_epic2, public_epic1])
......
......@@ -28,7 +28,7 @@ RSpec.describe Mutations::Boards::Issues::IssueMoveList do
end
subject do
mutation.resolve(params.merge(move_params))
mutation.resolve(**params.merge(move_params))
end
describe '#resolve' do
......
......@@ -28,13 +28,13 @@ RSpec.describe Mutations::Boards::Lists::Create do
describe '#ready?' do
it 'raises an error if required arguments are missing' do
expect { mutation.ready?({ board_id: 'some id' }) }
expect { mutation.ready?(board_id: 'some id') }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError,
'one and only one of backlog or labelId or milestoneId or assigneeId is required')
end
it 'raises an error if too many required arguments are specified' do
expect { mutation.ready?({ board_id: 'some id', milestone_id: 'some milestone', assignee_id: 'some label' }) }
expect { mutation.ready?(board_id: 'some id', milestone_id: 'some milestone', assignee_id: 'some label') }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError,
'one and only one of backlog or labelId or milestoneId or assigneeId is required')
end
......
......@@ -22,7 +22,7 @@ RSpec.describe Mutations::Boards::Lists::UpdateLimitMetrics do
describe '#ready?' do
it 'raises an error if required arguments are missing' do
expect { mutation.ready?({ list_id: 'some id' }) }.to raise_error(Gitlab::Graphql::Errors::ArgumentError, "At least one of the arguments " \
expect { mutation.ready?(list_id: 'some id') }.to raise_error(Gitlab::Graphql::Errors::ArgumentError, "At least one of the arguments " \
"limitMetric, maxIssueCount or maxIssueWeight is required")
end
end
......
......@@ -10,7 +10,7 @@ RSpec.describe Mutations::Boards::UpdateEpicUserPreferences do
let_it_be(:epic) { create(:epic, group: group) }
let(:context) { { current_user: user } }
subject(:mutation) { described_class.new(object: nil, context: context, field: nil).resolve(mutation_params) }
subject(:mutation) { described_class.new(object: nil, context: context, field: nil).resolve(**mutation_params) }
describe '#resolve' do
before do
......
......@@ -27,7 +27,7 @@ RSpec.describe Mutations::Boards::Update do
}
end
subject { mutation.resolve(mutation_params) }
subject { mutation.resolve(**mutation_params) }
specify { expect(described_class).to require_graphql_authorizations(:admin_board) }
......@@ -89,7 +89,7 @@ RSpec.describe Mutations::Boards::Update do
end
it 'raises exception when mutually exclusive params are given' do
expect { mutation.ready?(mutation_params) }
expect { mutation.ready?(**mutation_params) }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError, /one and only one of/)
end
end
......
......@@ -39,7 +39,7 @@ RSpec.describe Mutations::Issues::Create do
stub_licensed_features(issuable_health_status: true)
end
subject { mutation.resolve(mutation_params) }
subject { mutation.resolve(**mutation_params) }
context 'when user can create issues' do
before do
......
......@@ -31,7 +31,7 @@ RSpec.describe Mutations::Issues::Update do
let(:current_user) { user }
let(:mutation) { described_class.new(object: nil, context: { current_user: current_user }, field: nil) }
subject { mutation.resolve(params) }
subject { mutation.resolve(**params) }
before do
group.clear_memoization(:feature_available)
......
......@@ -262,11 +262,11 @@ RSpec.describe Group do
it 'does not exceed SQL queries count' do
groups = described_class.where(id: subgroup1)
control_count = ActiveRecord::QueryRecorder.new do
described_class.groups_user_can_read_epics(groups, user, params)
described_class.groups_user_can_read_epics(groups, user, **params)
end.count
groups = described_class.where(id: [subgroup1, subgroup2])
expect { described_class.groups_user_can_read_epics(groups, user, params) }
expect { described_class.groups_user_can_read_epics(groups, user, **params) }
.not_to exceed_query_limit(control_count + extra_query_count)
end
end
......
......@@ -17,7 +17,7 @@ RSpec.describe Repositories::GitHttpController, type: :request do
describe 'GET #info_refs' do
context 'smartcard session required' do
subject { clone_get(path, env) }
subject { clone_get(path, **env) }
before do
stub_licensed_features(smartcard_auth: true)
......@@ -70,7 +70,7 @@ RSpec.describe Repositories::GitHttpController, type: :request do
end
describe 'POST #git_receive_pack' do
subject { push_post(path, env) }
subject { push_post(path, **env) }
context 'when node is a primary Geo one' do
before do
......
......@@ -14,7 +14,7 @@ RSpec.shared_examples 'updating health status' do
end
end
subject { mutation.resolve(params) }
subject { mutation.resolve(**params) }
context 'when the user has permission' do
before do
......
......@@ -133,7 +133,7 @@ RSpec.shared_examples 'a blob replicator' do
expect(::Geo::FileRegistryRemovalService)
.to receive(:new).with(secondary_side_replicator.replicable_name, model_record_id, blob_path).and_return(service)
secondary_side_replicator.consume(:deleted, deleted_params)
secondary_side_replicator.consume(:deleted, **deleted_params)
end
end
end
......
......@@ -56,8 +56,8 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do
visit profile_active_sessions_path
expect(page).to(
have_selector('ul.list-group li.list-group-item', { text: 'Signed in on',
count: 2 }))
have_selector('ul.list-group li.list-group-item', text: 'Signed in on',
count: 2))
expect(page).to have_content(
'127.0.0.1 ' \
......
......@@ -8,7 +8,7 @@ RSpec.describe Ci::PipelineSchedulesFinder do
let!(:active_schedule) { create(:ci_pipeline_schedule, project: project) }
let!(:inactive_schedule) { create(:ci_pipeline_schedule, :inactive, project: project) }
subject { described_class.new(project).execute(params) }
subject { described_class.new(project).execute(**params) }
describe "#execute" do
context 'when the scope is nil' do
......
......@@ -18,7 +18,7 @@ RSpec.describe FeatureFlagsFinder do
end
describe '#execute' do
subject { finder.execute(args) }
subject { finder.execute(**args) }
let!(:feature_flag_1) { create(:operations_feature_flag, name: 'flag-a', project: project) }
let!(:feature_flag_2) { create(:operations_feature_flag, name: 'flag-b', project: project) }
......
......@@ -11,7 +11,7 @@ RSpec.describe Mutations::AlertManagement::HttpIntegration::Destroy do
specify { expect(described_class).to require_graphql_authorizations(:admin_operations) }
describe '#resolve' do
subject(:resolve) { mutation_for(project, current_user).resolve(args) }
subject(:resolve) { mutation_for(project, current_user).resolve(**args) }
context 'user has access to project' do
before do
......
......@@ -11,7 +11,7 @@ RSpec.describe Mutations::AlertManagement::HttpIntegration::ResetToken do
specify { expect(described_class).to require_graphql_authorizations(:admin_operations) }
describe '#resolve' do
subject(:resolve) { mutation_for(project, current_user).resolve(args) }
subject(:resolve) { mutation_for(project, current_user).resolve(**args) }
context 'user has sufficient access to project' do
before do
......
......@@ -11,7 +11,7 @@ RSpec.describe Mutations::AlertManagement::PrometheusIntegration::ResetToken do
specify { expect(described_class).to require_graphql_authorizations(:admin_project) }
describe '#resolve' do
subject(:resolve) { mutation_for(project, current_user).resolve(args) }
subject(:resolve) { mutation_for(project, current_user).resolve(**args) }
context 'user has sufficient access to project' do
before do
......
......@@ -12,7 +12,7 @@ RSpec.describe Mutations::AlertManagement::UpdateAlertStatus do
specify { expect(described_class).to require_graphql_authorizations(:update_alert_management_alert) }
describe '#resolve' do
subject(:resolve) { mutation_for(project, current_user).resolve(args) }
subject(:resolve) { mutation_for(project, current_user).resolve(**args) }
context 'user has access to project' do
before do
......
......@@ -34,18 +34,18 @@ RSpec.describe Mutations::Boards::Issues::IssueMoveList do
end
subject do
mutation.resolve(params.merge(move_params))
mutation.resolve(**params.merge(move_params))
end
describe '#ready?' do
it 'raises an error if required arguments are missing' do
expect { mutation.ready?(params) }
expect { mutation.ready?(**params) }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError, "At least one of the arguments " \
"fromListId, toListId, afterId or beforeId is required")
end
it 'raises an error if only one of fromListId and toListId is present' do
expect { mutation.ready?(params.merge(from_list_id: list1.id)) }
expect { mutation.ready?(**params.merge(from_list_id: list1.id)) }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError,
'Both fromListId and toListId must be present'
)
......
......@@ -14,7 +14,7 @@ RSpec.describe Mutations::ContainerExpirationPolicies::Update do
specify { expect(described_class).to require_graphql_authorizations(:destroy_container_image) }
describe '#resolve' do
subject { described_class.new(object: project, context: { current_user: user }, field: nil).resolve(params) }
subject { described_class.new(object: project, context: { current_user: user }, field: nil).resolve(**params) }
RSpec.shared_examples 'returning a success' do
it 'returns the container expiration policy with no errors' do
......
......@@ -11,7 +11,7 @@ RSpec.describe Mutations::Discussions::ToggleResolve do
describe '#resolve' do
subject do
mutation.resolve({ id: id_arg, resolve: resolve_arg })
mutation.resolve(id: id_arg, resolve: resolve_arg)
end
let(:id_arg) { discussion.to_global_id.to_s }
......
......@@ -51,7 +51,7 @@ RSpec.describe Mutations::Issues::Create do
project.add_guest(assignee2)
end
subject { mutation.resolve(mutation_params) }
subject { mutation.resolve(**mutation_params) }
context 'when the user does not have permission to create an issue' do
it 'raises an error' do
......@@ -117,7 +117,7 @@ RSpec.describe Mutations::Issues::Create do
end
it 'raises exception when mutually exclusive params are given' do
expect { mutation.ready?(mutation_params) }
expect { mutation.ready?(**mutation_params) }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError, /one and only one of/)
end
end
......@@ -128,7 +128,7 @@ RSpec.describe Mutations::Issues::Create do
end
it 'raises exception when mutually exclusive params are given' do
expect { mutation.ready?(mutation_params) }
expect { mutation.ready?(**mutation_params) }
.to raise_error(Gitlab::Graphql::Errors::ArgumentError, /to resolve a discussion please also provide `merge_request_to_resolve_discussions_of` parameter/)
end
end
......@@ -139,7 +139,7 @@ RSpec.describe Mutations::Issues::Create do
end
it 'raises exception when mutually exclusive params are given' do
expect { mutation.ready?(mutation_params) }.not_to raise_error
expect { mutation.ready?(**mutation_params) }.not_to raise_error
end
end
end
......
......@@ -58,7 +58,7 @@ RSpec.describe Mutations::Labels::Create do
end
describe '#ready?' do
subject { mutation.ready?(attributes.merge(extra_params)) }
subject { mutation.ready?(**attributes.merge(extra_params)) }
context 'when passing both project_path and group_path' do
let(:extra_params) { { project_path: 'foo', group_path: 'bar' } }
......
......@@ -7,7 +7,7 @@ RSpec.describe Mutations::Notes::RepositionImageDiffNote do
describe '#resolve' do
subject do
mutation.resolve({ note: note, position: new_position })
mutation.resolve(note: note, position: new_position)
end
let_it_be(:noteable) { create(:merge_request) }
......
......@@ -118,7 +118,7 @@ RSpec.describe ApplicationHelper do
def element(*arguments)
@time = Time.zone.parse('2015-07-02 08:23')
element = helper.time_ago_with_tooltip(@time, *arguments)
element = helper.time_ago_with_tooltip(@time, **arguments)
Nokogiri::HTML::DocumentFragment.parse(element).first_element_child
end
......
......@@ -18,7 +18,7 @@ RSpec.describe Gitlab::Cleanup::ProjectUploads do
let(:args) { [dry_run: false] }
it 'moves the file to its proper location' do
subject.run!(*args)
subject.run!(**args)
expect(File.exist?(path)).to be_falsey
expect(File.exist?(new_path)).to be_truthy
......@@ -28,13 +28,13 @@ RSpec.describe Gitlab::Cleanup::ProjectUploads do
expect(logger).to receive(:info).with("Looking for orphaned project uploads to clean up...")
expect(logger).to receive(:info).with("Did #{action}")
subject.run!(*args)
subject.run!(**args)
end
end
shared_examples_for 'a dry run' do
it 'does not move the file' do
subject.run!(*args)
subject.run!(**args)
expect(File.exist?(path)).to be_truthy
expect(File.exist?(new_path)).to be_falsey
......@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Cleanup::ProjectUploads do
expect(logger).to receive(:info).with("Looking for orphaned project uploads to clean up. Dry run...")
expect(logger).to receive(:info).with("Can #{action}")
subject.run!(*args)
subject.run!(**args)
end
end
......
......@@ -357,7 +357,7 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
end
it 'sends an RPC request with the correct payload' do
expect(client.commits_by_message(query, options)).to match_array(wrap_commits(commits))
expect(client.commits_by_message(query, **options)).to match_array(wrap_commits(commits))
end
end
......
......@@ -242,7 +242,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
}
expect { authorize_artifacts_with_token_in_headers(artifact_type: :lsif) }
.to change { Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(tracking_params) }
.to change { Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(**tracking_params) }
.by(1)
end
end
......
......@@ -428,7 +428,7 @@ RSpec.describe API::GoProxy do
context 'with a non-existent project' do
def get_resource(user = nil, **params)
get api("/projects/not%2fa%2fproject/packages/go/#{base}/@v/list", user, params)
get api("/projects/not%2fa%2fproject/packages/go/#{base}/@v/list", user, **params)
end
describe 'GET /projects/:id/packages/go/*module_name/@v/list' do
......@@ -465,7 +465,7 @@ RSpec.describe API::GoProxy do
end
def get_resource(user = nil, headers: {}, **params)
get api("/projects/#{project.id}/packages/go/#{module_name}/@v/#{resource}", user, params), headers: headers
get api("/projects/#{project.id}/packages/go/#{module_name}/@v/#{resource}", user, **params), headers: headers
end
def fmt_pseudo_version(prefix, commit)
......
......@@ -13,7 +13,7 @@ RSpec.describe EventCreateService do
tracking_params = { event_action: event_action, date_from: Date.yesterday, date_to: Date.today }
expect { subject }
.to change { Gitlab::UsageDataCounters::TrackUniqueEvents.count_unique_events(tracking_params) }
.to change { Gitlab::UsageDataCounters::TrackUniqueEvents.count_unique_events(**tracking_params) }
.by(1)
end
end
......@@ -386,7 +386,7 @@ RSpec.describe EventCreateService do
counter_class = Gitlab::UsageDataCounters::TrackUniqueEvents
tracking_params = { event_action: event_action, date_from: Date.yesterday, date_to: Date.today }
expect { subject }.not_to change { counter_class.count_unique_events(tracking_params) }
expect { subject }.not_to change { counter_class.count_unique_events(**tracking_params) }
end
end
end
......
......@@ -91,7 +91,7 @@ RSpec.describe Projects::MoveAccessService do
it 'does not remove remaining memberships' do
target_project.add_maintainer(maintainer_user)
subject.execute(project_with_access, options)
subject.execute(project_with_access, **options)
expect(project_with_access.project_members.count).not_to eq 0
end
......@@ -99,7 +99,7 @@ RSpec.describe Projects::MoveAccessService do
it 'does not remove remaining group links' do
target_project.project_group_links.create!(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER)
subject.execute(project_with_access, options)
subject.execute(project_with_access, **options)
expect(project_with_access.project_group_links.count).not_to eq 0
end
......@@ -107,7 +107,7 @@ RSpec.describe Projects::MoveAccessService do
it 'does not remove remaining authorizations' do
target_project.add_developer(developer_user)
subject.execute(project_with_access, options)
subject.execute(project_with_access, **options)
expect(project_with_access.project_authorizations.count).not_to eq 0
end
......
......@@ -51,7 +51,7 @@ RSpec.describe Projects::MoveDeployKeysProjectsService do
it 'does not remove remaining deploy keys projects' do
target_project.deploy_keys << project_with_deploy_keys.deploy_keys.first
subject.execute(project_with_deploy_keys, options)
subject.execute(project_with_deploy_keys, **options)
expect(project_with_deploy_keys.deploy_keys_projects.count).not_to eq 0
end
......
......@@ -48,7 +48,7 @@ RSpec.describe Projects::MoveLfsObjectsProjectsService do
it 'does not remove remaining lfs objects' do
target_project.lfs_objects << project_with_lfs_objects.lfs_objects.first(2)
subject.execute(project_with_lfs_objects, options)
subject.execute(project_with_lfs_objects, **options)
expect(project_with_lfs_objects.lfs_objects.count).not_to eq 0
end
......
......@@ -49,7 +49,7 @@ RSpec.describe Projects::MoveNotificationSettingsService do
let(:options) { { remove_remaining_elements: false } }
it 'does not remove remaining notification settings' do
subject.execute(project_with_notifications, options)
subject.execute(project_with_notifications, **options)
expect(project_with_notifications.notification_settings.count).not_to eq 0
end
......
......@@ -49,7 +49,7 @@ RSpec.describe Projects::MoveProjectAuthorizationsService do
target_project.add_maintainer(developer_user)
target_project.add_developer(reporter_user)
subject.execute(project_with_users, options)
subject.execute(project_with_users, **options)
expect(project_with_users.project_authorizations.count).not_to eq 0
end
......
......@@ -58,7 +58,7 @@ RSpec.describe Projects::MoveProjectGroupLinksService do
target_project.project_group_links.create!(group: maintainer_group, group_access: Gitlab::Access::MAINTAINER)
target_project.project_group_links.create!(group: developer_group, group_access: Gitlab::Access::DEVELOPER)
subject.execute(project_with_groups, options)
subject.execute(project_with_groups, **options)
expect(project_with_groups.project_group_links.count).not_to eq 0
end
......
......@@ -58,7 +58,7 @@ RSpec.describe Projects::MoveProjectMembersService do
target_project.add_maintainer(developer_user)
target_project.add_developer(reporter_user)
subject.execute(project_with_users, options)
subject.execute(project_with_users, **options)
expect(project_with_users.project_members.count).not_to eq 0
end
......
......@@ -20,7 +20,7 @@ RSpec.describe Suggestions::ApplyService do
position_args = args.slice(:old_path, :new_path, :old_line, :new_line)
content_args = args.slice(:from_content, :to_content)
position = build_position(position_args)
position = build_position(**position_args)
diff_note = create(:diff_note_on_merge_request,
noteable: merge_request,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment