FIX: false overrides should be permitted via ENV
This commit is contained in:
parent
3939b9ec7d
commit
b1e68390f4
|
@ -121,7 +121,7 @@ module SiteSettingExtension
|
|||
# exists it will be used instead of the setting and the setting will be hidden.
|
||||
# Useful for things like API keys on multisite.
|
||||
if opts[:shadowed_by_global] && GlobalSetting.respond_to?(name)
|
||||
if (val = GlobalSetting.send(name)).present?
|
||||
unless (val = GlobalSetting.send(name)) == ''.freeze
|
||||
hidden_settings << name
|
||||
shadowed_settings << name
|
||||
current_value = val
|
||||
|
|
|
@ -470,6 +470,18 @@ describe SiteSettingExtension do
|
|||
end
|
||||
end
|
||||
|
||||
context "with a false override" do
|
||||
before do
|
||||
GlobalSetting.stubs(:bool).returns(false)
|
||||
settings.setting(:bool, true, shadowed_by_global: true)
|
||||
settings.refresh!
|
||||
end
|
||||
|
||||
it "should return default cause nothing is set" do
|
||||
expect(settings.bool).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
context "with global setting" do
|
||||
before do
|
||||
GlobalSetting.stubs(:trout_api_key).returns('purringcat')
|
||||
|
|
Loading…
Reference in New Issue