Commit 418dbb87 authored by Thong Kuah's avatar Thong Kuah

Set const_get in Simplifiable to not inherit scope

Also fix specs to define the constants for the :entry class, not the
ancestor class Simplifiable
parent 886436ac
......@@ -35,15 +35,13 @@ module Gitlab
@strategies ||= []
end
# rubocop:disable Cop/ConstGetInheritFalse
def self.entry_class(strategy)
if strategy.present?
self.const_get(strategy.name)
self.const_get(strategy.name, false)
else
self::UnknownStrategy
end
end
# rubocop:enable Cop/ConstGetInheritFalse
def self.default
end
......
......@@ -24,9 +24,9 @@ describe Gitlab::Config::Entry::Simplifiable do
let(:unknown) { double('unknown strategy') }
before do
stub_const("#{described_class.name}::Something", first)
stub_const("#{described_class.name}::DifferentOne", second)
stub_const("#{described_class.name}::UnknownStrategy", unknown)
entry::Something = first
entry::DifferentOne = second
entry::UnknownStrategy = unknown
end
context 'when first strategy should be used' do
......
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