Add specs to hidding settings when shadowed by a global.
This commit is contained in:
parent
11afb20772
commit
6075debc90
|
@ -119,6 +119,7 @@ module SiteSettingExtension
|
|||
|
||||
if opts[:shadowed_by_global] && GlobalSetting.respond_to?(name)
|
||||
val = GlobalSetting.send(name)
|
||||
|
||||
unless val.nil? || (val == ''.freeze)
|
||||
hidden_settings << name
|
||||
shadowed_settings << name
|
||||
|
|
|
@ -498,6 +498,17 @@ describe SiteSettingExtension do
|
|||
expect(settings.trout_api_key).to eq('purringcat')
|
||||
end
|
||||
|
||||
it "should add the key to the hidden_settings collection" do
|
||||
expect(settings.hidden_settings.include?(:trout_api_key)).to eq(true)
|
||||
|
||||
['', nil].each_with_index do |setting, index|
|
||||
GlobalSetting.stubs(:"trout_api_key_#{index}").returns(setting)
|
||||
settings.setting(:"trout_api_key_#{index}", 'evil', shadowed_by_global: true)
|
||||
settings.refresh!
|
||||
expect(settings.hidden_settings.include?(:"trout_api_key_#{index}")).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
it "should add the key to the shadowed_settings collection" do
|
||||
expect(settings.shadowed_settings.include?(:trout_api_key)).to eq(true)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue