Simplify code related to setting default config values
This commit is contained in:
parent
7b712d3598
commit
3c5846cdaa
3 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue