Commit 8f7c98ee authored by Grzegorz Bizon's avatar Grzegorz Bizon

Rename CI config job script entry node to commands

parent 6aefb9e9
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
## ##
# Entry that represents a job script. # Entry that represents a job script.
# #
class JobScript < Entry class Commands < Entry
include Validatable include Validatable
validations do validations do
...@@ -14,11 +14,15 @@ module Gitlab ...@@ -14,11 +14,15 @@ module Gitlab
validate :string_or_array_of_strings validate :string_or_array_of_strings
def string_or_array_of_strings def string_or_array_of_strings
unless validate_string(config) || validate_array_of_strings(config) unless config_valid?
errors.add(:config, errors.add(:config,
'should be a string or an array of strings') 'should be a string or an array of strings')
end end
end end
def config_valid?
validate_string(config) || validate_array_of_strings(config)
end
end end
def value def value
......
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
node :before_script, Script, node :before_script, Script,
description: 'Global before script overridden in this job.' description: 'Global before script overridden in this job.'
node :script, JobScript, node :script, Commands,
description: 'Commands that will be executed in this job.' description: 'Commands that will be executed in this job.'
node :stage, Stage, node :stage, Stage,
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Config::Node::JobScript do describe Gitlab::Ci::Config::Node::Commands do
let(:entry) { described_class.new(config) } let(:entry) { described_class.new(config) }
context 'when entry config value is an array' do context 'when entry config value is an array' do
...@@ -41,7 +41,7 @@ describe Gitlab::Ci::Config::Node::JobScript do ...@@ -41,7 +41,7 @@ describe Gitlab::Ci::Config::Node::JobScript do
describe '#errors' do describe '#errors' do
it 'saves errors' do it 'saves errors' do
expect(entry.errors) expect(entry.errors)
.to include 'job script config should be a ' \ .to include 'commands config should be a ' \
'string or an array of strings' 'string or an array of strings'
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