summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/config
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-10-26 22:02:09 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-10-26 22:02:18 +0200
commitd9b56bc13b94bdc69a14a2b4201e25e141a62ce4 (patch)
tree05c2a52bad0f160c565d160b518c7baa6c93eb4d /spec/lib/gitlab/ci/config
parente997b22df50a46759cac9936a6557993310f8888 (diff)
downloadgitlab-ce-d9b56bc13b94bdc69a14a2b4201e25e141a62ce4.tar.gz
Add parallel keyword to CI config
Diffstat (limited to 'spec/lib/gitlab/ci/config')
-rw-r--r--spec/lib/gitlab/ci/config/entry/job_spec.rb33
1 files changed, 31 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb
index 1169938b80c..718098c364e 100644
--- a/spec/lib/gitlab/ci/config/entry/job_spec.rb
+++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb
@@ -1,5 +1,4 @@
-require 'fast_spec_helper'
-require_dependency 'active_model'
+require 'spec_helper'
describe Gitlab::Ci::Config::Entry::Job do
let(:entry) { described_class.new(config, name: :rspec) }
@@ -138,6 +137,36 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
+ context 'when parallel value is not correct' do
+ context 'when it is not a numeric value' do
+ let(:config) { { parallel: true } }
+
+ it 'returns error about invalid type' do
+ expect(entry).not_to be_valid
+ expect(entry.errors).to include 'job parallel is not a number'
+ end
+ end
+
+ context 'when it is lower than one' do
+ let(:config) { { parallel: 0 } }
+
+ it 'returns error about value too low' do
+ expect(entry).not_to be_valid
+ expect(entry.errors)
+ .to include 'job parallel must be greater than or equal to 1'
+ end
+ end
+
+ context 'when it is not an integer' do
+ let(:config) { { parallel: 1.5 } }
+
+ it 'returns error about wrong value' do
+ expect(entry).not_to be_valid
+ expect(entry.errors).to include 'job parallel must be an integer'
+ end
+ end
+ end
+
context 'when delayed job' do
context 'when start_in is specified' do
let(:config) { { script: 'echo', when: 'delayed', start_in: '1 day' } }