Use Redis#new instead of deprecated Redis#connect

According to commit: redis/redis-rb@7193c30 in redis gem
Redis.connect is deprecated.
This commit is contained in:
Kostas Diamantis 2015-12-22 11:56:35 +02:00
parent b87f00320f
commit be18701c45
3 changed files with 5 additions and 5 deletions

View file

@ -3,7 +3,7 @@ require 'redis'
class RedisWidget
def self.redis
threaded ||= Redis.connect
threaded ||= Redis.new
end
def self.redis=(connection)
@ -45,7 +45,7 @@ end
class RedisWidgetUsingDatabaseOne < RedisWidget
def self.redis
threaded[self.class.to_s] ||= Redis.connect :url => ENV['REDIS_URL_ONE']
threaded[self.class.to_s] ||= Redis.new :url => ENV['REDIS_URL_ONE']
end
def self.create!
@ -56,7 +56,7 @@ end
class RedisWidgetUsingDatabaseTwo < RedisWidget
def self.redis
threaded[self.class.to_s] ||= Redis.connect :url => ENV['REDIS_URL_TWO']
threaded[self.class.to_s] ||= Redis.new :url => ENV['REDIS_URL_TWO']
end
def self.create!

View file

@ -22,7 +22,7 @@ module DatabaseCleaner
private
def connection
@connection ||= url == :default ? ::Redis.connect : ::Redis.connect(:url => url)
@connection ||= url == :default ? ::Redis.new : ::Redis.new(:url => url)
end
end

View file

@ -9,7 +9,7 @@ module DatabaseCleaner
describe Truncation do
before(:all) do
config = YAML::load(File.open("#{File.dirname(__FILE__)}/../../../examples/config/redis.yml"))
@redis = ::Redis.connect :url => config['test']['url']
@redis = ::Redis.new :url => config['test']['url']
end
before(:each) do