lib/fakeredis.rb in fakeredis-0.7.0 vs lib/fakeredis.rb in fakeredis-0.8.0
- old
+ new
@@ -13,6 +13,22 @@
end
def self.disable
Redis::Connection.drivers.delete_if {|driver| Redis::Connection::Memory == driver }
end
+
+ def self.disabling
+ return yield unless enabled?
+
+ disable
+ yield
+ enable
+ end
+
+ def self.enabling
+ return yield if enabled?
+
+ enable
+ yield
+ disable
+ end
end