Commit 67f51b6a authored by Thong Kuah's avatar Thong Kuah

Autocorrect keyword deprecations

Based on deprecations/ files downloaded from
https://gitlab.com/gitlab-org/gitlab/-/pipelines/220179974
parent e584927a
......@@ -12,7 +12,7 @@ FactoryBot.define do
skip_create
initialize_with do
::Gitlab::Ci::Reports::Security::FindingKey.new(attributes)
::Gitlab::Ci::Reports::Security::FindingKey.new(**attributes)
end
end
end
......@@ -7,7 +7,7 @@ RSpec.describe CustomProjectTemplatesFinder do
let(:base_params) { { current_user: user } }
let(:params) { {} }
subject { described_class.new(base_params.merge(params)) }
subject { described_class.new(**base_params.merge(params)) }
it 'returns an empty relation if group is not set' do
expect(subject.execute).to be_empty
......
......@@ -23,7 +23,7 @@ RSpec.describe Gitlab::Analytics::TypeOfWork::TasksByType do
end
subject do
described_class.new(params).counts_by_labels
described_class.new(**params).counts_by_labels
end
around do |example|
......@@ -121,7 +121,7 @@ RSpec.describe Gitlab::Analytics::TypeOfWork::TasksByType do
end
shared_examples '#top_labels' do
let(:top_labels) { described_class.new(params).top_labels }
let(:top_labels) { described_class.new(**params).top_labels }
let!(:with_label) do
create(factory_name, {
......@@ -144,7 +144,7 @@ RSpec.describe Gitlab::Analytics::TypeOfWork::TasksByType do
end
it 'limits the the size of the results' do
expect(described_class.new(params).top_labels(1)).to eq([other_label])
expect(described_class.new(**params).top_labels(1)).to eq([other_label])
end
end
......
......@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Ci::Ansi2json::Result do
{ lines: [], state: state, append: false, truncated: false, offset: offset, stream: stream }
end
subject { described_class.new(params) }
subject { described_class.new(**params) }
describe '#size' do
before do
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::Ci::Ansi2json::Style do
describe '#set?' do
subject { described_class.new(params).set? }
subject { described_class.new(**params).set? }
context 'when fg color is set' do
let(:params) { { fg: 'term-fg-black' } }
......@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Ci::Ansi2json::Style do
end
describe 'update formats to mimic terminals' do
subject { described_class.new(params) }
subject { described_class.new(**params) }
context 'when fg color present' do
let(:params) { { fg: 'term-fg-black', mask: mask } }
......
......@@ -142,7 +142,7 @@ RSpec.describe Gitlab::Ci::Build::Artifacts::Metadata do
it 'reads expected number of entries' do
stream = File.open(tmpfile.path)
metadata = described_class.new(stream, 'public', { recursive: true })
metadata = described_class.new(stream, 'public', recursive: true)
expect(metadata.find_entries!.count).to eq entry_count
end
......
......@@ -81,7 +81,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Image do
context 'when configuration has ports' do
let(:ports) { [{ number: 80, protocol: 'http', name: 'foobar' }] }
let(:config) { { name: 'ruby:2.7', entrypoint: %w(/bin/sh run), ports: ports } }
let(:entry) { described_class.new(config, { with_image_ports: image_ports }) }
let(:entry) { described_class.new(config, with_image_ports: image_ports) }
let(:image_ports) { false }
context 'when with_image_ports metadata is not enabled' do
......
......@@ -96,7 +96,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Service do
{ name: 'postgresql:9.5', alias: 'db', command: %w(cmd run), entrypoint: %w(/bin/sh run), ports: ports }
end
let(:entry) { described_class.new(config, { with_image_ports: image_ports }) }
let(:entry) { described_class.new(config, with_image_ports: image_ports) }
let(:image_ports) { false }
context 'when with_image_ports metadata is not enabled' do
......
......@@ -38,7 +38,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Services do
context 'when configuration has ports' do
let(:ports) { [{ number: 80, protocol: 'http', name: 'foobar' }] }
let(:config) { ['postgresql:9.5', { name: 'postgresql:9.1', alias: 'postgres_old', ports: ports }] }
let(:entry) { described_class.new(config, { with_image_ports: image_ports }) }
let(:entry) { described_class.new(config, with_image_ports: image_ports) }
let(:image_ports) { false }
context 'when with_image_ports metadata is not enabled' do
......
......@@ -11,7 +11,7 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do
project.add_maintainer(user)
end
let(:stage_summary) { described_class.new(project, options).data }
let(:stage_summary) { described_class.new(project, **options).data }
describe "#new_issues" do
subject { stage_summary.first }
......@@ -121,7 +121,7 @@ RSpec.describe Gitlab::CycleAnalytics::StageSummary do
end
it 'does not include commit stats' do
data = described_class.new(project, options).data
data = described_class.new(project, **options).data
expect(includes_commits?(data)).to be_falsy
end
......
......@@ -6,7 +6,7 @@ require "spec_helper"
RSpec.describe Gitlab::Email::ReplyParser do
describe '#execute' do
def test_parse_body(mail_string, params = {})
described_class.new(Mail::Message.new(mail_string), params).execute
described_class.new(Mail::Message.new(**mail_string), **params).execute
end
it "returns an empty string if the message is blank" do
......
......@@ -10,7 +10,7 @@ RSpec.describe Gitlab::Graphql::Pagination::ExternallyPaginatedArrayConnection d
let(:arguments) { {} }
subject(:connection) do
described_class.new(all_nodes, { max_page_size: values.size }.merge(arguments))
described_class.new(all_nodes, **{ max_page_size: values.size }.merge(arguments))
end
it_behaves_like 'a connection with collection methods'
......
......@@ -10,11 +10,11 @@ RSpec.describe Gitlab::Graphql::Pagination::Keyset::Connection do
let(:context) { GraphQL::Query::Context.new(query: OpenStruct.new(schema: schema), values: nil, object: nil) }
subject(:connection) do
described_class.new(nodes, { context: context, max_page_size: 3 }.merge(arguments))
described_class.new(nodes, **{ context: context, max_page_size: 3 }.merge(arguments))
end
def encoded_cursor(node)
described_class.new(nodes, { context: context }).cursor_for(node)
described_class.new(nodes, context: context).cursor_for(node)
end
def decoded_cursor(cursor)
......
......@@ -24,7 +24,7 @@ RSpec.describe Ci::CreateJobArtifactsService do
upload = Tempfile.new('upload')
FileUtils.copy(path, upload.path)
UploadedFile.new(upload.path, params)
UploadedFile.new(upload.path, **params)
end
describe '#execute' do
......
......@@ -25,7 +25,7 @@ RSpec.configure do |config|
original_null_store = Rails.cache
caching_config_hash = Gitlab::Redis::Cache.params
caching_config_hash[:namespace] = Gitlab::Redis::Cache::CACHE_NAMESPACE
Rails.cache = ActiveSupport::Cache::RedisCacheStore.new(caching_config_hash)
Rails.cache = ActiveSupport::Cache::RedisCacheStore.new(**caching_config_hash)
redis_cache_cleanup!
......
......@@ -2,7 +2,7 @@
module GitlabVerifyHelpers
def collect_ranges(args = {})
verifier = described_class.new(args.merge(batch_size: 1))
verifier = described_class.new(**args.merge(batch_size: 1))
collect_results(verifier).map { |range, _| range }
end
......
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