Commit 91885022 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'tkuah-spec-kwargs-1' into 'master'

Fix some Ruby 2.7 kwarg warnings in specs

See merge request gitlab-org/gitlab!44672
parents 73aa3730 2bc223c3
...@@ -9,7 +9,7 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do ...@@ -9,7 +9,7 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do
let(:api_url) { 'https://kubernetes.example.com/prefix' } let(:api_url) { 'https://kubernetes.example.com/prefix' }
let(:kubeclient_options) { { auth_options: { bearer_token: 'xyz' } } } let(:kubeclient_options) { { auth_options: { bearer_token: 'xyz' } } }
let(:client) { described_class.new(api_url, kubeclient_options) } let(:client) { described_class.new(api_url, **kubeclient_options) }
before do before do
stub_kubeclient_discover(api_url) stub_kubeclient_discover(api_url)
...@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do ...@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do
end end
it 'falls back to default options, but allows overriding' do it 'falls back to default options, but allows overriding' do
client = Gitlab::Kubernetes::KubeClient.new(api_url, {}) client = described_class.new(api_url)
defaults = Gitlab::Kubernetes::KubeClient::DEFAULT_KUBECLIENT_OPTIONS defaults = Gitlab::Kubernetes::KubeClient::DEFAULT_KUBECLIENT_OPTIONS
expect(client.kubeclient_options[:timeouts]).to eq(defaults[:timeouts]) expect(client.kubeclient_options[:timeouts]).to eq(defaults[:timeouts])
......
...@@ -99,7 +99,7 @@ RSpec.describe Gitlab::SidekiqCluster do ...@@ -99,7 +99,7 @@ RSpec.describe Gitlab::SidekiqCluster do
allow(Process).to receive(:spawn).and_return(1) allow(Process).to receive(:spawn).and_return(1)
expect(described_class).to receive(:wait_async).with(1) expect(described_class).to receive(:wait_async).with(1)
expect(described_class.start_sidekiq(%w(foo), options)).to eq(1) expect(described_class.start_sidekiq(%w(foo), **options)).to eq(1)
end end
it 'handles duplicate queue names' do it 'handles duplicate queue names' do
...@@ -109,7 +109,7 @@ RSpec.describe Gitlab::SidekiqCluster do ...@@ -109,7 +109,7 @@ RSpec.describe Gitlab::SidekiqCluster do
.and_return(1) .and_return(1)
expect(described_class).to receive(:wait_async).with(1) expect(described_class).to receive(:wait_async).with(1)
expect(described_class.start_sidekiq(%w(foo foo bar baz), options)).to eq(1) expect(described_class.start_sidekiq(%w(foo foo bar baz), **options)).to eq(1)
end end
it 'runs the sidekiq process in a new process group' do it 'runs the sidekiq process in a new process group' do
...@@ -119,7 +119,7 @@ RSpec.describe Gitlab::SidekiqCluster do ...@@ -119,7 +119,7 @@ RSpec.describe Gitlab::SidekiqCluster do
.and_return(1) .and_return(1)
allow(described_class).to receive(:wait_async) allow(described_class).to receive(:wait_async)
expect(described_class.start_sidekiq(%w(foo bar baz), options)).to eq(1) expect(described_class.start_sidekiq(%w(foo bar baz), **options)).to eq(1)
end end
end end
......
...@@ -18,13 +18,13 @@ RSpec.describe EachBatch do ...@@ -18,13 +18,13 @@ RSpec.describe EachBatch do
shared_examples 'each_batch handling' do |kwargs| shared_examples 'each_batch handling' do |kwargs|
it 'yields an ActiveRecord::Relation when a block is given' do it 'yields an ActiveRecord::Relation when a block is given' do
model.each_batch(kwargs) do |relation| model.each_batch(**kwargs) do |relation|
expect(relation).to be_a_kind_of(ActiveRecord::Relation) expect(relation).to be_a_kind_of(ActiveRecord::Relation)
end end
end end
it 'yields a batch index as the second argument' do it 'yields a batch index as the second argument' do
model.each_batch(kwargs) do |_, index| model.each_batch(**kwargs) do |_, index|
expect(index).to eq(1) expect(index).to eq(1)
end end
end end
...@@ -32,7 +32,7 @@ RSpec.describe EachBatch do ...@@ -32,7 +32,7 @@ RSpec.describe EachBatch do
it 'accepts a custom batch size' do it 'accepts a custom batch size' do
amount = 0 amount = 0
model.each_batch(kwargs.merge({ of: 1 })) { amount += 1 } model.each_batch(**kwargs.merge({ of: 1 })) { amount += 1 }
expect(amount).to eq(5) expect(amount).to eq(5)
end 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