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