diff options
| author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-08-17 15:04:58 +0200 |
|---|---|---|
| committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-09-04 14:17:01 +0200 |
| commit | 9a4117ab5bc278e8ee3fac376340808b56c09767 (patch) | |
| tree | b6ee2158807ec39f66a53772edf78a0680e54c4a /spec/lib | |
| parent | 880865599f92285150e94f891cad326bf0239435 (diff) | |
| download | gitlab-ce-9a4117ab5bc278e8ee3fac376340808b56c09767.tar.gz | |
Add support for `extends` key in CI/CD configuration
Diffstat (limited to 'spec/lib')
| -rw-r--r-- | spec/lib/gitlab/ci/config_spec.rb | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/config_spec.rb b/spec/lib/gitlab/ci/config_spec.rb index 2e204da307d..2b0ce9a95e0 100644 --- a/spec/lib/gitlab/ci/config_spec.rb +++ b/spec/lib/gitlab/ci/config_spec.rb @@ -1,4 +1,6 @@ -require 'spec_helper' +require 'fast_spec_helper' + +require_dependency 'active_model' describe Gitlab::Ci::Config do let(:config) do @@ -42,6 +44,36 @@ describe Gitlab::Ci::Config do end end + context 'when using extendable hash' do + let(:yml) do + <<-EOS + image: ruby:2.2 + + rspec: + script: rspec + + test: + extends: rspec + image: ruby:alpine + EOS + end + + it 'correctly extends the hash' do + hash = { + image: 'ruby:2.2', + rspec: { script: 'rspec' }, + test: { + extends: 'rspec', + image: 'ruby:alpine', + script: 'rspec' + } + } + + expect(config).to be_valid + expect(config.to_hash).to eq hash + end + end + context 'when config is invalid' do context 'when yml is incorrect' do let(:yml) { '// invalid' } @@ -49,7 +81,7 @@ describe Gitlab::Ci::Config do describe '.new' do it 'raises error' do expect { config }.to raise_error( - ::Gitlab::Ci::Config::Loader::FormatError, + described_class::ConfigError, /Invalid configuration format/ ) end |
