diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-06 10:43:11 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-06 10:43:11 +0200 |
commit | 8048dcc8e693d713a94a7b9361672692f4e5932f (patch) | |
tree | a1e950928ef04785fd67b940be2746ce9ed49a9c /spec/lib | |
parent | 7f2f683eeb2c3b443f519e2e83dbb3d789a00cf8 (diff) | |
download | gitlab-ce-8048dcc8e693d713a94a7b9361672692f4e5932f.tar.gz |
Implement CI configuration nodes tree processing
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/ci/config/node/before_script_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/node/global_spec.rb | 30 |
2 files changed, 30 insertions, 6 deletions
diff --git a/spec/lib/gitlab/ci/config/node/before_script_spec.rb b/spec/lib/gitlab/ci/config/node/before_script_spec.rb index eb86931c586..d4a8eea3fff 100644 --- a/spec/lib/gitlab/ci/config/node/before_script_spec.rb +++ b/spec/lib/gitlab/ci/config/node/before_script_spec.rb @@ -2,10 +2,4 @@ require 'spec_helper' describe Gitlab::Ci::Config::Node::BeforeScript do let(:entry) { described_class.new(hash, config) } - - describe '#leaf?' do - it 'is a leaf entry' do - expect(entry).to be_leaf - end - end end diff --git a/spec/lib/gitlab/ci/config/node/global_spec.rb b/spec/lib/gitlab/ci/config/node/global_spec.rb index 89594fa20ce..e2e8fcfabd3 100644 --- a/spec/lib/gitlab/ci/config/node/global_spec.rb +++ b/spec/lib/gitlab/ci/config/node/global_spec.rb @@ -1,5 +1,35 @@ require 'spec_helper' describe Gitlab::Ci::Config::Node::Global do + let(:global) { described_class.new(hash, config) } + let(:config) { double('Config') } + describe '#keys' do + it 'can contain global config keys' do + expect(global.keys).to include :before_script + end + end + + context 'when hash is valid' do + let(:hash) do + { before_script: ['ls', 'pwd'] } + end + + describe '#process!' do + before { global.process! } + + it 'creates nodes hash' do + expect(global.nodes).to be_a Hash + end + + it 'creates node object for each entry' do + expect(global.nodes.count).to eq 1 + end + + it 'creates node object using valid class' do + expect(global.nodes[:before_script]) + .to be_an_instance_of Gitlab::Ci::Config::Node::BeforeScript + end + end + end end |