Add minor improvements in readability in CI config
This commit is contained in:
parent
eb151e77ff
commit
bfad4c61f1
|
@ -26,9 +26,7 @@ module Gitlab
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_node(key, factory)
|
def create_node(key, factory)
|
||||||
factory.with(value: @config[key])
|
factory.with(value: @config[key], key: key, parent: self)
|
||||||
factory.with(parent: self)
|
|
||||||
factory.with(key: key)
|
|
||||||
|
|
||||||
factory.create!
|
factory.create!
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.default
|
def self.default
|
||||||
%w(build test deploy)
|
%w[build test deploy]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,6 +23,7 @@ module Gitlab
|
||||||
|
|
||||||
def unknown_keys
|
def unknown_keys
|
||||||
return [] unless config.is_a?(Hash)
|
return [] unless config.is_a?(Hash)
|
||||||
|
|
||||||
config.keys - @node.class.nodes.keys
|
config.keys - @node.class.nodes.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -551,8 +551,8 @@ module Ci
|
||||||
config_processor = GitlabCiYamlProcessor.new(config, path)
|
config_processor = GitlabCiYamlProcessor.new(config, path)
|
||||||
|
|
||||||
##
|
##
|
||||||
# When variables config is empty, we asumme this is a correct,
|
# When variables config is empty, we assume this is a valid
|
||||||
# see issue #18775
|
# configuration, see issue #18775
|
||||||
#
|
#
|
||||||
expect(config_processor.job_variables(:rspec))
|
expect(config_processor.job_variables(:rspec))
|
||||||
.to be_an_instance_of(Array).and be_empty
|
.to be_an_instance_of(Array).and be_empty
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe Gitlab::Ci::Config::Node::Boolean do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when entry value is not valid' do
|
context 'when entry value is not valid' do
|
||||||
let(:config) { [ 'incorrect' ] }
|
let(:config) { ['incorrect'] }
|
||||||
|
|
||||||
describe '#errors' do
|
describe '#errors' do
|
||||||
it 'saves errors' do
|
it 'saves errors' do
|
||||||
|
|
|
@ -22,7 +22,6 @@ describe Gitlab::Ci::Config::Node::Configurable do
|
||||||
validator.validate
|
validator.validate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
context 'when node validator is invalid' do
|
context 'when node validator is invalid' do
|
||||||
let(:instance) { node.new('ls') }
|
let(:instance) { node.new('ls') }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue