Commit d41d3301 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add CI config node that is unspecified null entry

parent 8c9c3eda
module Gitlab
module Ci
class Config
module Node
##
# This class represents an undefined and unspecified node.
#
# Implements the Null Object pattern.
#
class Null < Entry
def initialize(config = nil, **attributes)
super
end
def value
nil
end
def valid?
true
end
def errors
[]
end
end
end
end
end
end
require 'spec_helper'
describe Gitlab::Ci::Config::Node::Null do
let(:null) { described_class.new }
describe '#leaf?' do
it 'is leaf node' do
expect(null).to be_leaf
end
end
describe '#valid?' do
it 'is always valid' do
expect(null).to be_valid
end
end
describe '#errors' do
it 'is does not contain errors' do
expect(null.errors).to be_empty
end
end
describe '#value' do
it 'returns nil' do
expect(null.value).to eq nil
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