diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-14 16:23:52 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-07-14 16:45:07 +0300 |
commit | 3e16b015b969a4d5d28240e76bffd382b0772f49 (patch) | |
tree | 720ec13b11b4a55205f4335da0b79b75890243a7 /spec/lib/gitlab/ci | |
parent | f7c80e9f31944c0001c9bef23d1a8efe33e4adce (diff) |
Revert logical validation in CI job stage entry
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r-- | spec/lib/gitlab/ci/config/node/stage_spec.rb | 71 |
1 files changed, 6 insertions, 65 deletions
diff --git a/spec/lib/gitlab/ci/config/node/stage_spec.rb b/spec/lib/gitlab/ci/config/node/stage_spec.rb index 004012f8b38..fb9ec70762a 100644 --- a/spec/lib/gitlab/ci/config/node/stage_spec.rb +++ b/spec/lib/gitlab/ci/config/node/stage_spec.rb @@ -1,17 +1,12 @@ require 'spec_helper' describe Gitlab::Ci::Config::Node::Stage do - let(:stage) { described_class.new(config, global: global) } - let(:global) { spy('Global') } + let(:stage) { described_class.new(config) } describe 'validations' do context 'when stage config value is correct' do let(:config) { 'build' } - before do - allow(global).to receive(:stages).and_return(%w[build]) - end - describe '#value' do it 'returns a stage key' do expect(stage.value).to eq config @@ -25,66 +20,12 @@ describe Gitlab::Ci::Config::Node::Stage do end end - context 'when stage config is incorrect' do - describe '#errors' do - context 'when reference to global node is not set' do - let(:stage) { described_class.new('test') } - - it 'raises error' do - expect { stage.validate! }.to raise_error( - Gitlab::Ci::Config::Node::Entry::InvalidError, - /Entry needs global attribute set internally./ - ) - end - end - - context 'when value has a wrong type' do - let(:config) { { test: true } } - - it 'reports errors about wrong type' do - expect(stage.errors) - .to include 'stage config should be a string' - end - end - - context 'when stage is not present in global configuration' do - let(:config) { 'unknown' } - - before do - allow(global) - .to receive(:stages).and_return(%w[test deploy]) - end - - it 'reports error about missing stage' do - stage.validate! - - expect(stage.errors) - .to include 'stage config should be one of ' \ - 'defined stages (test, deploy)' - end - end - end - end - end - - describe '#known?' do - before do - allow(global).to receive(:stages).and_return(%w[test deploy]) - end - - context 'when stage is not known' do - let(:config) { :unknown } - - it 'returns false' do - expect(stage.known?).to be false - end - end - - context 'when stage is known' do - let(:config) { 'test' } + context 'when value has a wrong type' do + let(:config) { { test: true } } - it 'returns false' do - expect(stage.known?).to be true + it 'reports errors about wrong type' do + expect(stage.errors) + .to include 'stage config should be a string' end end end |