diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb index a6a46d6390b..7912d8dbea2 100644 --- a/lib/site_setting_extension.rb +++ b/lib/site_setting_extension.rb @@ -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 diff --git a/spec/components/site_setting_extension_spec.rb b/spec/components/site_setting_extension_spec.rb index 8d9fd2eb82a..f6982e8ef0c 100644 --- a/spec/components/site_setting_extension_spec.rb +++ b/spec/components/site_setting_extension_spec.rb @@ -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')