Skip to content
Snippets Groups Projects
Commit e8f995ef authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Pass root Ci config entry to each subsequent entry

parent 69a3755c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -13,7 +13,7 @@ module Gitlab
end
 
@config = loader.load
@global = Node::Global.new(@config, self)
@global = Node::Global.new(@config)
@global.process!
end
 
Loading
Loading
Loading
Loading
@@ -7,14 +7,14 @@ module Gitlab
 
attr_reader :value, :nodes, :parent
 
def initialize(value, config, parent = nil)
def initialize(value, root = nil, parent = nil)
@value = value
@config = config
@root = root
@parent = parent
@nodes, @errors = [], []
 
keys.each_key do |key|
instance_variable_set("@#{key}", Null.new(nil, config, self))
instance_variable_set("@#{key}", Null.new(nil, root, self))
end
end
 
Loading
Loading
@@ -24,7 +24,7 @@ module Gitlab
keys.each do |key, entry_class|
next unless @value.has_key?(key)
 
entry = entry_class.new(@value[key], @config, self)
entry = entry_class.new(@value[key], @root, self)
instance_variable_set("@#{key}", entry)
@nodes.append(entry)
end
Loading
Loading
@@ -42,7 +42,7 @@ module Gitlab
end
 
def leaf?
keys.none?
keys.none? # TODO || !@value.is_a?(Hash)
end
 
def keys
Loading
Loading
require 'spec_helper'
 
describe Gitlab::Ci::Config::Node::BeforeScript do
let(:entry) { described_class.new(value, config) }
let(:config) { double('config') }
let(:entry) { described_class.new(value, double)}
 
describe '#validate!' do
before { entry.validate! }
Loading
Loading
require 'spec_helper'
 
describe Gitlab::Ci::Config::Node::Global do
let(:global) { described_class.new(hash, config) }
let(:config) { double('Config') }
let(:global) { described_class.new(hash) }
 
describe '#keys' do
it 'can contain global config keys' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment