Commit f48261a4 authored by Matija Čupić's avatar Matija Čupić

Refactor Normalizer specs

parent 4b2b154c
......@@ -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
......
......@@ -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
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