fix caching of default account in forked selenium specs

test plan:
 * run all specs in spec/selenium/content_migrations_spec.rb serially

Change-Id: Ic23b718b296a8a205eed654a77c37723a8111329
Reviewed-on: https://gerrit.instructure.com/9851
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
This commit is contained in:
Cody Cutrer 2012-04-05 13:03:22 -06:00
parent 3f35882cf4
commit eada83cc48
1 changed files with 8 additions and 0 deletions

View File

@ -639,6 +639,14 @@ class Account < ActiveRecord::Base
special_account_id = @special_account_ids[special_account_type] ||= Setting.get("#{special_account_type}_account_id", nil)
account = @special_accounts[special_account_type] = Account.find_by_id(special_account_id) if special_account_id
end
# another process (i.e. selenium spec) may have changed the setting
unless account
special_account_id = Setting.get("#{special_account_type}_account_id", nil)
if special_account_id && special_account_id != @special_account_ids[special_account_type]
@special_account_ids[special_account_type] = special_account_id
account = @special_accounts[special_account_type] = Account.find_by_id(special_account_id)
end
end
unless account
# TODO i18n
t '#account.default_site_administrator_account_name', 'Site Admin'