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

Rename method that returns allowed nodes in Ci config

parent 99ee39bf
No related branches found
No related tags found
1 merge request!4482Add global entry with before script to new CI config
Pipeline #
Loading
Loading
@@ -24,7 +24,7 @@ module Gitlab
end
end
 
def keys
def allowed_nodes
self.class.nodes || {}
end
 
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ module Gitlab
end
 
def compose!
keys.each do |key, entry|
allowed_nodes.each do |key, entry|
add_node(key, entry)
end
end
Loading
Loading
@@ -46,23 +46,23 @@ module Gitlab
end
 
def leaf?
keys.none?
allowed_nodes.none?
end
 
def has_config?
@value.is_a?(Hash)
end
 
def keys
{}
end
def errors
@errors + nodes.map(&:errors).flatten
end
 
def allowed_nodes
{}
end
def method_missing(name, *args)
super unless keys.has_key?(name)
super unless allowed_nodes.has_key?(name)
raise InvalidError unless valid?
 
@nodes[name].try(:value)
Loading
Loading
Loading
Loading
@@ -3,13 +3,13 @@ require 'spec_helper'
describe Gitlab::Ci::Config::Node::Global do
let(:global) { described_class.new(hash) }
 
describe '#keys' do
describe '#allowed_nodes' do
it 'can contain global config keys' do
expect(global.keys).to include :before_script
expect(global.allowed_nodes).to include :before_script
end
 
it 'returns a hash' do
expect(global.keys).to be_a Hash
expect(global.allowed_nodes).to be_a Hash
end
end
 
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