summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-09-05 10:27:21 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-09-05 10:27:21 +0200
commit7efef550da5e0901b7a4b6f94d49395fabbf2d38 (patch)
treedd98698d1b212ca8d16444fd394f0bb00b753c85
parentb19d2e1e6d75a3568ad7b9ea00a9bee216ed55ec (diff)
downloadgitlab-ce-7efef550da5e0901b7a4b6f94d49395fabbf2d38.tar.gz
Add unit test for `extends` in .gitlab-ci.yml
-rw-r--r--spec/lib/gitlab/ci/config/entry/job_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb
index 6769f64f950..2c9758401b7 100644
--- a/spec/lib/gitlab/ci/config/entry/job_spec.rb
+++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb
@@ -1,4 +1,5 @@
-require 'spec_helper'
+require 'fast_spec_helper'
+require_dependency 'active_model'
describe Gitlab::Ci::Config::Entry::Job do
let(:entry) { described_class.new(config, name: :rspec) }
@@ -81,6 +82,15 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
+ context 'when extends key is not a string' do
+ let(:config) { { extends: 123 } }
+
+ it 'returns error about wrong value type' do
+ expect(entry).not_to be_valid
+ expect(entry.errors).to include "job extends should be a string"
+ end
+ end
+
context 'when retry value is not correct' do
context 'when it is not a numeric value' do
let(:config) { { retry: true } }
@@ -124,6 +134,8 @@ describe Gitlab::Ci::Config::Entry::Job do
describe '#relevant?' do
it 'is a relevant entry' do
+ entry = described_class.new({ script: 'rspec' }, name: :rspec)
+
expect(entry).to be_relevant
end
end