strip plugin settings values
fixes CORE-1253 test plan * configure BBB with spaces on the end of the domain * after you save, the spaces should be gone Change-Id: I6ecf87cb436e87b19149649daab9a737e573d548 Reviewed-on: https://gerrit.instructure.com/146033 Reviewed-by: Rob Orton <rob@instructure.com> Tested-by: Jenkins QA-Review: Tucker McKnight <tmcknight@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
61025629cd
commit
cf3e3b2e2e
|
@ -46,6 +46,7 @@ class PluginSetting < ActiveRecord::Base
|
|||
def validate_posted_settings
|
||||
if @posted_settings
|
||||
plugin = Canvas::Plugin.find(name.to_s)
|
||||
@posted_settings.transform_values(&:strip!)
|
||||
result = plugin.validate_settings(self, @posted_settings)
|
||||
throw :abort if result == false
|
||||
end
|
||||
|
|
|
@ -32,6 +32,21 @@ describe PluginsController do
|
|||
expect(ps).to be_enabled
|
||||
end
|
||||
|
||||
it 'it trims posted params' do
|
||||
ps = PluginSetting.new(name: 'big_blue_button')
|
||||
ps.settings = { }.with_indifferent_access
|
||||
ps.disabled = false
|
||||
ps.save!
|
||||
|
||||
allow(controller).to receive(:require_setting_site_admin).and_return(true)
|
||||
# The 'all' parameter is necessary for this test to pass when the
|
||||
# multiple root acoounts plugin is installed
|
||||
put 'update', params: {id: 'big_blue_button', settings: { domain: ' abc ', secret: 'secret', recording_enabled: '0' }, all: 1}
|
||||
expect(response).to be_redirect
|
||||
ps.reload
|
||||
expect(ps.settings[:domain]).to eq 'abc'
|
||||
end
|
||||
|
||||
context "account_reports" do
|
||||
it 'can disable reports' do
|
||||
ps = PluginSetting.new(name: 'account_reports')
|
||||
|
|
Loading…
Reference in New Issue