BUGFIX: hide sensitive site settings

This commit is contained in:
Régis Hanol
2014-01-06 13:03:53 +01:00
parent a1f80e9e51
commit 8d73b7f94d
4 changed files with 21 additions and 16 deletions

View File

@ -25,30 +25,24 @@ describe Admin::SiteSettingsController do
context 'update' do
it 'requires a value parameter' do
lambda { xhr :put, :update, id: 'test_setting' }.should raise_error(ActionController::ParameterMissing)
end
it 'sets the value when the param is present' do
SiteSetting.expects(:'test_setting=').with('hello').once
xhr :put, :update, id: 'test_setting', value: 'hello'
xhr :put, :update, id: 'test_setting', test_setting: 'hello'
end
it 'allows value to be a blank string' do
SiteSetting.expects(:'test_setting=').with('').once
xhr :put, :update, id: 'test_setting', value: ''
xhr :put, :update, id: 'test_setting', test_setting: ''
end
it 'logs the change' do
SiteSetting.stubs(:test_setting).returns('previous')
SiteSetting.expects(:'test_setting=').with('hello').once
StaffActionLogger.any_instance.expects(:log_site_setting_change).with('test_setting', 'previous', 'hello')
xhr :put, :update, id: 'test_setting', value: 'hello'
xhr :put, :update, id: 'test_setting', test_setting: 'hello'
end
end
end
end