mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
BUGFIX: hide sensitive site settings
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user