Commit ce4478ed authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add ci config entry that represents array of paths

parent e017e1b6
module Gitlab
module Ci
class Config
module Node
##
# Entry that represents an array of paths.
#
class Paths < Entry
include Validatable
validations do
validates :config, array_of_strings: true
end
end
end
end
end
end
require 'spec_helper'
describe Gitlab::Ci::Config::Node::Paths do
let(:entry) { described_class.new(config) }
describe 'validations' do
context 'when entry config value is valid' do
let(:config) { ['some/file', 'some/path/'] }
describe '#value' do
it 'returns key value' do
expect(entry.value).to eq config
end
end
describe '#valid?' do
it 'is valid' do
expect(entry).to be_valid
end
end
end
context 'when entry value is not valid' do
let(:config) { [ 1 ] }
describe '#errors' do
it 'saves errors' do
expect(entry.errors)
.to include 'Paths config should be an array of strings'
end
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