# Require this either in your Gemfile or in RSpec's 
# support scripts. Examples: 
#
#   # Gemfile
#   group :test do
#     gem "rspec"
#     gem "fakeredis", :require => "fakeredis/rspec"
#   end 
#
#   # spec/support/fakeredis.rb
#   require 'fakeredis/rspec'
#

require 'rspec/core'
require 'fakeredis'

RSpec.configure do |c|
  
  c.before do    
    redis = Redis.current
    redis.flushdb if redis.client.connection.is_a?(Redis::Connection::Memory)
  end
  
end

# Require this either in your Gemfile or in RSpec's
# support scripts. Examples:
#
#   # Gemfile
#   group :test do
#     gem "rspec"
#     gem "fakeredis", :require => "fakeredis/rspec"
#   end
#
#   # spec/support/fakeredis.rb
#   require 'fakeredis/rspec'
#

require 'rspec/core'
require 'fakeredis'

RSpec.configure do |c|

  c.before do    
    Redis::Connection::Memory.instances.values.each &:flushdb
  end

end

Reset all instances we know of before each spec
Reset all instances we know of before each spec

Because we know all the redis memory instances we've created, we can just flush just those from spec to spec.
