summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/ci/config/entry/job_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/job_spec.rb')
-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' } }