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