diff --git a/lib/gitlab/ci/config/normalizer.rb b/lib/gitlab/ci/config/normalizer.rb index 7bd0e08e817..bfe976c04bf 100644 --- a/lib/gitlab/ci/config/normalizer.rb +++ b/lib/gitlab/ci/config/normalizer.rb @@ -27,7 +27,7 @@ module Gitlab def parallelize_jobs(jobs_config, parallelized_jobs) jobs_config.each_with_object({}) do |(job_name, config), hash| - if parallelized_jobs.keys.include?(job_name) + if parallelized_jobs.key?(job_name) parallelized_jobs[job_name].each { |name, index| hash[name.to_sym] = config.merge(name: name, instance: index) } else hash[job_name] = config diff --git a/spec/lib/gitlab/ci/config/normalizer_spec.rb b/spec/lib/gitlab/ci/config/normalizer_spec.rb index 2c8396199d0..2e3d3cc1b2b 100644 --- a/spec/lib/gitlab/ci/config/normalizer_spec.rb +++ b/spec/lib/gitlab/ci/config/normalizer_spec.rb @@ -15,7 +15,7 @@ describe Gitlab::Ci::Config::Normalizer do end it 'has parallelized jobs' do - job_names = described_class.send(:parallelize_job_names, job_name, 5).map { |job_name, index| job_name.to_sym } + job_names = [:"rspec 1/5", :"rspec 2/5", :"rspec 3/5", :"rspec 4/5", :"rspec 5/5"] is_expected.to include(*job_names) end @@ -35,18 +35,10 @@ describe Gitlab::Ci::Config::Normalizer do let(:config) { { job_name => job_config, other_job: { script: 'echo 1', dependencies: [job_name.to_s] } } } it 'parallelizes dependencies' do - job_names = described_class.send(:parallelize_job_names, job_name, 5).map(&:first) + job_names = ["rspec 1/5", "rspec 2/5", "rspec 3/5", "rspec 4/5", "rspec 5/5"] expect(subject[:other_job][:dependencies]).to include(*job_names) end end end - - describe '.parallelize_job_names' do - subject { described_class.send(:parallelize_job_names, job_name, 5) } - - it 'returns parallelized names' do - expect(subject.map(&:first)).to all(match(%r{#{job_name} \d+/\d+})) - end - end end