Cleanup settings cache on tests
I have global settings configured. However, even if I unset the value within an after
block, when I run the test again, it's getting a default value. I found out it was getting the value from the cache.
RSpec.configure do |config|
# ...
config.after(:suite) do
# ...
Setting.thing_scoped.each do |r|
Rails.cache.delete("settings:#{r.var}")
end
end
end
Written by Marvin Marcelo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#