clean up some usage of plugin_path

refs CNVS-35957

test plan: tests should pass, plugin settings should still work

Change-Id: I143ff73449f3d0241963649c3c91d0f76d04a429
Reviewed-on: https://gerrit.instructure.com/106834
Tested-by: Jenkins
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2017-03-29 13:26:26 -06:00
parent b40b4fea40
commit 40a2a15365
3 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@ class PluginsController < ApplicationController
@plugin_setting.posted_settings = params[:settings] || {} unless @plugin_setting.disabled
if @plugin_setting.save
flash[:notice] = t('notices.settings_updated', "Plugin settings successfully updated.")
redirect_to plugin_path(@plugin.id, :all => params[:all])
redirect_to plugin_path(@plugin.id)
else
@settings = @plugin.settings
flash[:error] = t('errors.setting_update_failed', "There was an error saving the plugin settings.")

View File

@ -10,7 +10,7 @@
<%= render :partial => "settings_header" %>
<div id="settings">
<%= form_for(@plugin_setting, :url => plugin_path(@plugin.id, :all => params[:all]), :html => {:method => :put}) do |f| %>
<%= form_for(@plugin_setting, :url => plugin_path(@plugin.id), :html => {:method => :put}) do |f| %>
<div style="margin-bottom: 15px; margin-top: -10px;">
<%= f.check_box :disabled, :class => "disabled_checkbox" %>
<%= f.label :disabled, :en => "Disable this Plugin" %>

View File

@ -26,21 +26,21 @@ describe PluginsController do
expect(PluginSetting.find_by(name: 'account_reports')).to be_nil
controller.stubs(:require_setting_site_admin).returns(true)
put 'update', id: 'account_reports', all: 1, plugin_setting: { disabled: false }
expect(response).to redirect_to(plugin_path('account_reports', all: 1))
put 'update', id: 'account_reports', account_id: Account.default.id, plugin_setting: { disabled: false }
expect(response).to be_redirect
ps = PluginSetting.find_by!(name: 'account_reports')
expect(ps).to be_enabled
end
context "account_reports" do
it 'can disable reports' do
ps = PluginSetting.new(name: 'account_reports')
ps = PluginSetting.new(name: 'account_reports', account_id: Account.default.id)
ps.settings = { course_storage_csv: true }.with_indifferent_access
ps.save!
controller.stubs(:require_setting_site_admin).returns(true)
put 'update', id: 'account_reports', all: 1, settings: { 'course_storage_csv' => '0' }
expect(response).to redirect_to(plugin_path('account_reports', all: 1))
put 'update', id: 'account_reports', account_id: Account.default.id, settings: { 'course_storage_csv' => '0' }
expect(response).to be_redirect
ps.reload
expect(ps.settings[:course_storage_csv]).to eq false
end