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