Make it possible to set a site setting to empty string

This commit is contained in:
Neil Lalonde 2013-06-11 14:31:38 -04:00
parent 811a0df68b
commit 82b5f57e40
2 changed files with 5 additions and 5 deletions
app/controllers/admin
spec/controllers/admin

View file

@ -7,7 +7,7 @@ class Admin::SiteSettingsController < Admin::AdminController
end
def update
params.require(:value)
raise ActionController::ParameterMissing.new(:value) unless params.has_key?(:value)
SiteSetting.send("#{params[:id]}=", params[:value])
render nothing: true
end

View file

@ -34,10 +34,10 @@ describe Admin::SiteSettingsController do
xhr :put, :update, id: 'test_setting', value: 'hello'
end
# it 'allows value to be a blank string' do
# SiteSetting.expects(:'test_setting=').with('').once
# xhr :put, :update, id: 'test_setting', value: ''
# end
it 'allows value to be a blank string' do
SiteSetting.expects(:'test_setting=').with('').once
xhr :put, :update, id: 'test_setting', value: ''
end
end
end