deprecate redis truncation's #url method in favor of #db.

This commit is contained in:
Micah Geisel 2020-05-24 14:20:56 -07:00
parent ee557984fc
commit dcd1599eb4
3 changed files with 8 additions and 3 deletions

View file

@ -8,6 +8,7 @@
* Deprecate all #orm= setter methods: https://github.com/DatabaseCleaner/database_cleaner/pull/643
* Deprecate non-functional :reset_ids option in ActiveRecord truncation strategy: https://github.com/DatabaseCleaner/database_cleaner/issues/559
* Deprecate mongo truncation's `:cache_tables => true` option in favor of `false`, to prep for caching removal in v2.0: https://github.com/DatabaseCleaner/database_cleaner/pull/646"
* Deprecate redis truncation's #url method in favor of #db: @botandrose
== Bugfixes

View file

@ -1,4 +1,5 @@
require 'database_cleaner/generic/base'
require 'database_cleaner/deprecation'
module DatabaseCleaner
module Redis
@ -21,7 +22,10 @@ module DatabaseCleaner
@db ||= :default
end
alias url db
def url
DatabaseCleaner.deprecate "The redis truncation strategy's #url method is deprecated. It will be removed in database_cleaner-redis 2.0 in favor of #db."
db
end
private
@ -32,7 +36,7 @@ module DatabaseCleaner
elsif db.is_a?(::Redis) # pass directly the connection
db
else
::Redis.new(:url => url)
::Redis.new(:url => db)
end
end
end

View file

@ -19,7 +19,7 @@ module DatabaseCleaner
else
connection.flushdb
end
connection.quit unless url == :default
connection.quit unless db == :default
end
end
end