diff --git a/History.rdoc b/History.rdoc index 5c18c86..19d79d6 100644 --- a/History.rdoc +++ b/History.rdoc @@ -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 diff --git a/adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb b/adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb index 1d90479..4a76e8d 100644 --- a/adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb +++ b/adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb @@ -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 diff --git a/adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb b/adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb index 32badcc..3216809 100644 --- a/adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb +++ b/adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb @@ -19,7 +19,7 @@ module DatabaseCleaner else connection.flushdb end - connection.quit unless url == :default + connection.quit unless db == :default end end end