mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
play around with mock_redis, add comment explaining what happened
This commit is contained in:
@@ -82,8 +82,29 @@ Spork.prefork do
|
|||||||
SiteSetting.provider = SiteSettings::LocalProcessProvider.new
|
SiteSetting.provider = SiteSettings::LocalProcessProvider.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class DiscourseMockRedis < MockRedis
|
||||||
|
def without_namespace
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_prefixed(prefix)
|
||||||
|
keys("#{prefix}*").each { |k| del(k) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
config.before :each do |x|
|
config.before :each do |x|
|
||||||
|
# TODO not sure about this, we could use a mock redis implementation here:
|
||||||
|
# this gives us really clean "flush" semantics, howere the side-effect is that
|
||||||
|
# we are no longer using a clean redis implementation, a preferable solution may
|
||||||
|
# be simply flushing before tests, trouble is that redis may be reused with dev
|
||||||
|
# so that would mean the dev would act weird
|
||||||
|
#
|
||||||
|
# perf benefit seems low (shaves 20 secs off a 4 minute test suite)
|
||||||
|
#
|
||||||
|
# $redis = DiscourseMockRedis.new
|
||||||
|
#
|
||||||
# disable all observers, enable as needed during specs
|
# disable all observers, enable as needed during specs
|
||||||
|
#
|
||||||
ActiveRecord::Base.observers.disable :all
|
ActiveRecord::Base.observers.disable :all
|
||||||
SiteSetting.provider.all.each do |setting|
|
SiteSetting.provider.all.each do |setting|
|
||||||
SiteSetting.remove_override!(setting.name)
|
SiteSetting.remove_override!(setting.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user