mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
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:
parent
b87f00320f
commit
be18701c45
3 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,7 @@ require 'redis'
|
||||||
class RedisWidget
|
class RedisWidget
|
||||||
|
|
||||||
def self.redis
|
def self.redis
|
||||||
threaded ||= Redis.connect
|
threaded ||= Redis.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.redis=(connection)
|
def self.redis=(connection)
|
||||||
|
@ -45,7 +45,7 @@ end
|
||||||
class RedisWidgetUsingDatabaseOne < RedisWidget
|
class RedisWidgetUsingDatabaseOne < RedisWidget
|
||||||
|
|
||||||
def self.redis
|
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
|
end
|
||||||
|
|
||||||
def self.create!
|
def self.create!
|
||||||
|
@ -56,7 +56,7 @@ end
|
||||||
class RedisWidgetUsingDatabaseTwo < RedisWidget
|
class RedisWidgetUsingDatabaseTwo < RedisWidget
|
||||||
|
|
||||||
def self.redis
|
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
|
end
|
||||||
|
|
||||||
def self.create!
|
def self.create!
|
||||||
|
|
|
@ -22,7 +22,7 @@ module DatabaseCleaner
|
||||||
private
|
private
|
||||||
|
|
||||||
def connection
|
def connection
|
||||||
@connection ||= url == :default ? ::Redis.connect : ::Redis.connect(:url => url)
|
@connection ||= url == :default ? ::Redis.new : ::Redis.new(:url => url)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ module DatabaseCleaner
|
||||||
describe Truncation do
|
describe Truncation do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
config = YAML::load(File.open("#{File.dirname(__FILE__)}/../../../examples/config/redis.yml"))
|
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
|
end
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
|
Loading…
Reference in a new issue