BigW Consortium Gitlab

Commit d7e12511 by Grzegorz Bizon

Rename method that returns allowed nodes in Ci config

parent 99ee39bf
......@@ -24,7 +24,7 @@ module Gitlab
end
end
def keys
def allowed_nodes
self.class.nodes || {}
end
......
......@@ -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
......@@ -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)
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment