mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
deprecate redis truncation's #url method in favor of #db.
This commit is contained in:
parent
ee557984fc
commit
dcd1599eb4
3 changed files with 8 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Deprecate all #orm= setter methods: https://github.com/DatabaseCleaner/database_cleaner/pull/643
|
* 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 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 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
|
== Bugfixes
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require 'database_cleaner/generic/base'
|
require 'database_cleaner/generic/base'
|
||||||
|
require 'database_cleaner/deprecation'
|
||||||
|
|
||||||
module DatabaseCleaner
|
module DatabaseCleaner
|
||||||
module Redis
|
module Redis
|
||||||
|
@ -21,7 +22,10 @@ module DatabaseCleaner
|
||||||
@db ||= :default
|
@db ||= :default
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
|
@ -32,7 +36,7 @@ module DatabaseCleaner
|
||||||
elsif db.is_a?(::Redis) # pass directly the connection
|
elsif db.is_a?(::Redis) # pass directly the connection
|
||||||
db
|
db
|
||||||
else
|
else
|
||||||
::Redis.new(:url => url)
|
::Redis.new(:url => db)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ module DatabaseCleaner
|
||||||
else
|
else
|
||||||
connection.flushdb
|
connection.flushdb
|
||||||
end
|
end
|
||||||
connection.quit unless url == :default
|
connection.quit unless db == :default
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue