diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-11-01 15:24:29 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-11-01 15:24:29 +0100 |
commit | 77715e47d633f3db3b6b58c1d67b4ddbe3668177 (patch) | |
tree | 327b198292ef973c7ddfe49302936a29512ecdd5 | |
parent | 56a08d233fe18892ae7a7c723662007e260a2c2d (diff) | |
download | gitlab-ce-77715e47d633f3db3b6b58c1d67b4ddbe3668177.tar.gz |
Add Normalizer specs
-rw-r--r-- | spec/lib/gitlab/ci/config/normalizer_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/normalizer_spec.rb b/spec/lib/gitlab/ci/config/normalizer_spec.rb new file mode 100644 index 00000000000..5890d4f193c --- /dev/null +++ b/spec/lib/gitlab/ci/config/normalizer_spec.rb @@ -0,0 +1,36 @@ +require 'fast_spec_helper' + +describe Gitlab::Ci::Config::Normalizer do + let(:job_name) { :rspec } + let(:job_config) { { script: 'rspec', parallel: 5 } } + let(:config) { { job_name => job_config } } + + describe '.normalize_jobs' do + subject { described_class.normalize_jobs(config) } + + it 'does not have original job' do + is_expected.not_to include(job_name) + end + + it 'has parallelized jobs' do + job_names = described_class.send(:parallelize_job_names, job_name, 5).map(&:to_sym) + + is_expected.to include(*job_names) + end + + it 'parallelizes jobs with original config' do + original_config = config[job_name].except(:name) + configs = subject.values.map { |config| config.except(:name) } + + expect(configs).to all(eq(original_config)) + end + end + + describe '.parallelize_job_names' do + subject { described_class.send(:parallelize_job_names, job_name, 5) } + + it 'returns parallelized names' do + is_expected.to all(match(%r{#{job_name} \d+/\d+})) + end + end +end |