spec: isolate plugin settings better in specs

fixes brittle ./spec/lib/app_center/app_api_spec.rb:112 and possibly
others. if #current_account is meaningful and gets set in one spec, make
sure it doesn't affect subsequent specs (in particular ones that use
caching)

Change-Id: I2b54fcf8e941a8d3a50c367f0f1d8e18d018d00b
Reviewed-on: https://gerrit.instructure.com/68784
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
This commit is contained in:
Jon Jensen 2015-12-11 12:23:29 -07:00
parent 45ed0d6b81
commit 31b36c5385
2 changed files with 4 additions and 0 deletions

View File

@ -142,4 +142,7 @@ class PluginSetting < ActiveRecord::Base
def self.find_by_name(name)
where(name: name).first
end
# stub for plugins who want to do something fancy
def self.current_account=(_); end
end

View File

@ -448,6 +448,7 @@ RSpec.configure do |config|
Time.zone = 'UTC'
LoadAccount.force_special_account_reload = true
Account.clear_special_account_cache!(true)
PluginSetting.current_account = nil
AdheresToPolicy::Cache.clear
Setting.reset_cache!
ConfigFile.unstub