Clear changes to settings after checking form saves them (#15746)

* Clear the cached community name before loading new page

When the creator settings form had been run before the create new page
spec, the community name would be changed from the default
"DEV(local)" to "Climbing Life". Since the application helper can
memoize this value - and the database will not - ensure these are in
sync by clearing the settings cache before requesting the page (which
will be prefilled based on the setting).

This "fix" should probably be moved into the test introducing the
change, rather than the one impacted by it.

* Move clearing the settings cache closer to the change

Rather than clearing the cache where we were impacted, clear
immediately after the save spec completes.
This commit is contained in:
Daniel Uber 2021-12-14 08:39:14 -06:00 committed by GitHub
parent 2b34941062
commit 1d26485c36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,6 +34,13 @@ RSpec.describe CreatorSettingsForm, type: :model do
describe "#save" do
let(:current_user) { create(:user) }
after do
# prevent changes here from leaking into other tests
Settings::Community.clear_cache
Settings::UserExperience.clear_cache
Settings::Authentication.clear_cache
end
# rubocop:disable RSpec/ExampleLength
it "saves the updated attributes to the correct Settings values", :aggregate_failures do
# NOTE: override the profile migration hack from rails_helper.rb