mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 13:13:39 +08:00
play around with mock_redis, add comment explaining what happened
This commit is contained in:
parent
da5446a438
commit
ff063f4f9b
|
@ -82,8 +82,29 @@ Spork.prefork do
|
|||
SiteSetting.provider = SiteSettings::LocalProcessProvider.new
|
||||
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|
|
||||
# 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
|
||||
#
|
||||
ActiveRecord::Base.observers.disable :all
|
||||
SiteSetting.provider.all.each do |setting|
|
||||
SiteSetting.remove_override!(setting.name)
|
||||
|
|
Loading…
Reference in New Issue
Block a user