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