diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-22 09:05:16 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-22 09:05:16 +0100 |
commit | 4c34b4e5171596bd09b621b66d9c2765f042483c (patch) | |
tree | 2e9ceb26de7deaae8a9643e210dc40ab1bd29dc8 /spec/lib | |
parent | 900999f8180e49aa1677286e3e0cfa08d47829a7 (diff) | |
download | gitlab-ce-4c34b4e5171596bd09b621b66d9c2765f042483c.tar.gz |
Extend specs for global ci configuration entry
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/global_spec.rb | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/global_spec.rb b/spec/lib/gitlab/ci/config/entry/global_spec.rb index 5e5c5dcc385..5683d875dd6 100644 --- a/spec/lib/gitlab/ci/config/entry/global_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/global_spec.rb @@ -13,7 +13,7 @@ describe Gitlab::Ci::Config::Entry::Global do end end - context 'when hash is valid' do + context 'when configuration is valid' do context 'when some entries defined' do let(:hash) do { before_script: ['ls', 'pwd'], @@ -225,29 +225,42 @@ describe Gitlab::Ci::Config::Entry::Global do end end - context 'when hash is not valid' do + context 'when configuration is not valid' do before { global.compose! } - let(:hash) do - { before_script: 'ls' } - end + context 'when before script is not an array' do + let(:hash) do + { before_script: 'ls' } + end - describe '#valid?' do - it 'is not valid' do - expect(global).not_to be_valid + describe '#valid?' do + it 'is not valid' do + expect(global).not_to be_valid + end end - end - describe '#errors' do - it 'reports errors from child nodes' do - expect(global.errors) - .to include 'before_script config should be an array of strings' + describe '#errors' do + it 'reports errors from child nodes' do + expect(global.errors) + .to include 'before_script config should be an array of strings' + end + end + + describe '#before_script_value' do + it 'returns nil' do + expect(global.before_script_value).to be_nil + end end end - describe '#before_script_value' do - it 'returns nil' do - expect(global.before_script_value).to be_nil + context 'when job does not have commands' do + let(:hash) { { rspec: { stage: 'test' } } } + + describe '#errors' do + it 'reports errors about missing script' do + expect(global.errors) + .to include "jobs:rspec script can't be blank" + end end end end @@ -281,7 +294,7 @@ describe Gitlab::Ci::Config::Entry::Global do { cache: { key: 'a' }, rspec: { script: 'ls' } } end - context 'when node exists' do + context 'when entry exists' do it 'returns correct entry' do expect(global[:cache]) .to be_an_instance_of Gitlab::Ci::Config::Entry::Cache @@ -289,7 +302,7 @@ describe Gitlab::Ci::Config::Entry::Global do end end - context 'when node does not exist' do + context 'when entry does not exist' do it 'always return unspecified node' do expect(global[:some][:unknown][:node]) .not_to be_specified |