Commit 3c5846cd authored by Grzegorz Bizon's avatar Grzegorz Bizon

Simplify code related to setting default config values

parent 7b712d35
......@@ -65,7 +65,7 @@ module Gitlab
end
def value
default.to_h.deep_merge(@subject.value.to_h)
default.to_h.deep_merge(subject.value.to_h)
end
end
end
......
......@@ -6,6 +6,8 @@ module Gitlab
class Simplifiable < SimpleDelegator
EntryStrategy = Struct.new(:name, :condition)
attr_reader :subject
def initialize(config, **metadata)
unless self.class.const_defined?(:UnknownStrategy)
raise ArgumentError, 'UndefinedStrategy not available!'
......
......@@ -30,11 +30,11 @@ describe Gitlab::Config::Entry::Configurable do
end
describe 'configured entries' do
let(:another) { double('another', default: nil) }
let(:entry_class) { double('entry_class', default: nil) }
before do
entry.class_exec(another) do |another|
entry :object, another, description: 'test object'
entry.class_exec(entry_class) do |entry_class|
entry :object, entry_class, description: 'test object'
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