add foodsoft_config protection whitelisting
This commit is contained in:
parent
3fee071a10
commit
f09ef892dc
2 changed files with 24 additions and 3 deletions
|
|
@ -5,11 +5,11 @@ describe FoodsoftConfig do
|
|||
let(:other_name) { Faker::Lorem.words(rand(2..4)).join(' ') }
|
||||
|
||||
it 'returns a default value' do
|
||||
expect(FoodsoftConfig[:protected][:database]).to be_true
|
||||
expect(FoodsoftConfig[:protected][:database]).to be true
|
||||
end
|
||||
|
||||
it 'returns an empty default value' do
|
||||
expect(FoodsoftConfig[:protected][:LIUhniuyGNKUQTWfbiOQIWYexngo78hqexul]).to be_false
|
||||
expect(FoodsoftConfig[:protected][:LIUhniuyGNKUQTWfbiOQIWYexngo78hqexul]).to be nil
|
||||
end
|
||||
|
||||
it 'returns a configuration value' do
|
||||
|
|
@ -60,6 +60,20 @@ describe FoodsoftConfig do
|
|||
end
|
||||
end
|
||||
|
||||
it 'can protect all values' do
|
||||
old_name = FoodsoftConfig[:name]
|
||||
FoodsoftConfig.config[:protected][:all] = true
|
||||
FoodsoftConfig[:name] = name
|
||||
expect(FoodsoftConfig[:name]).to eq old_name
|
||||
end
|
||||
|
||||
it 'can whitelist a value' do
|
||||
FoodsoftConfig.config[:protected][:all] = true
|
||||
FoodsoftConfig.config[:protected][:name] = false
|
||||
FoodsoftConfig[:name] = name
|
||||
expect(FoodsoftConfig[:name]).to eq name
|
||||
end
|
||||
|
||||
describe 'has indifferent access', type: :feature do
|
||||
it 'with symbol' do
|
||||
FoodsoftConfig[:name] = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue