database_cleaner 1.8.5 → 1.99.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +24 -25
  3. data/History.rdoc +18 -1
  4. data/README.markdown +2 -2
  5. data/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/truncation.rb +8 -0
  6. data/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/version.rb +1 -1
  7. data/adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato.rb +2 -0
  8. data/adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/version.rb +1 -1
  9. data/adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper.rb +2 -0
  10. data/adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/version.rb +1 -1
  11. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo.rb +1 -0
  12. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo/base.rb +1 -1
  13. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo/deletion.rb +8 -0
  14. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation.rb +16 -6
  15. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo/version.rb +1 -1
  16. data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper.rb +1 -0
  17. data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/version.rb +1 -1
  18. data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid.rb +1 -0
  19. data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/base.rb +1 -1
  20. data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/deletion.rb +10 -0
  21. data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/version.rb +1 -1
  22. data/adapters/database_cleaner-moped/lib/database_cleaner/moped.rb +2 -0
  23. data/adapters/database_cleaner-moped/lib/database_cleaner/moped/version.rb +1 -1
  24. data/adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j.rb +1 -0
  25. data/adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/version.rb +1 -1
  26. data/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/version.rb +1 -1
  27. data/adapters/database_cleaner-redis/lib/database_cleaner/redis.rb +1 -0
  28. data/adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb +7 -3
  29. data/adapters/database_cleaner-redis/lib/database_cleaner/redis/deletion.rb +9 -0
  30. data/adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb +1 -1
  31. data/adapters/database_cleaner-redis/lib/database_cleaner/redis/version.rb +1 -1
  32. data/adapters/database_cleaner-sequel/lib/database_cleaner/sequel/version.rb +1 -1
  33. data/lib/database_cleaner/base.rb +17 -1
  34. data/lib/database_cleaner/configuration.rb +2 -1
  35. data/lib/database_cleaner/version.rb +1 -1
  36. metadata +7 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51b1c0f591c9266160e7ba246ab5a2e0edc88ff8e55aa10b205dad2371db9222
4
- data.tar.gz: cbea6b1677f20cd1bc95eb0578df54933cdd329a034e67ef876b8bf9f1d406c6
3
+ metadata.gz: 93b54f2cfbd9e2d5dd08dd667ef971edaa28eecebbcff63b8f8afe464dd58aaa
4
+ data.tar.gz: 878b944b61afbf9d41ac619864e3fddf6ea7463da29e86ee946403ae7ab383f2
5
5
  SHA512:
6
- metadata.gz: 73ddb8b888360027d2f09c8c1f04a2e71605dad8b1166744df0b9b61c4c4ae382a5f43631857fe34ef8f899e7c0733351eddb014b6c729b8e394bd609ef484de
7
- data.tar.gz: e3a654d8957c9f200750c244995e293a7a487c82f9885204cd6e29ac382daf1acc6101c751a25e42cdd418dd1afe6b9c90b46bb2386ec08573afa447dc468122
6
+ metadata.gz: 071f21db72ba854d2ccb2d23e82369347c6740c76045fee3f9ae8931ca62b50f612d91a74998491d385a0e270f3d7e7689eadbe81ec4c0eec94de852ecbd410d
7
+ data.tar.gz: 0b42bf542aafc6890ca4fe5d7408eddd95cfc822031bdb6b1100547ba6f96006ed7f68eb175f1f306f9fda9a49eb049b7928fd21d28bab4aac3f7d61678bce05
@@ -1,46 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- database_cleaner (1.8.5)
4
+ database_cleaner (1.99.0.beta)
5
5
 
6
6
  PATH
7
7
  remote: adapters
8
8
  specs:
9
- database_cleaner-active_record (1.8.0)
9
+ database_cleaner-active_record (1.99.0.beta)
10
10
  activerecord
11
- database_cleaner (~> 1.8.0)
12
- database_cleaner-couch_potato (1.8.0)
11
+ database_cleaner (~> 1.99.0.beta)
12
+ database_cleaner-couch_potato (1.99.0.beta)
13
13
  couch_potato
14
- database_cleaner (~> 1.8.0)
15
- database_cleaner-data_mapper (1.8.0)
16
- database_cleaner (~> 1.8.0)
14
+ database_cleaner (~> 1.99.0.beta)
15
+ database_cleaner-data_mapper (1.99.0.beta)
16
+ database_cleaner (~> 1.99.0.beta)
17
17
  datamapper
18
18
  dm-transactions
19
- database_cleaner-mongo (1.8.0)
20
- database_cleaner (~> 1.8.0)
19
+ database_cleaner-mongo (1.99.0.beta)
20
+ database_cleaner (~> 1.99.0.beta)
21
21
  mongo
22
- database_cleaner-mongo_mapper (1.8.1)
23
- database_cleaner (~> 1.8.0)
22
+ database_cleaner-mongo_mapper (1.99.0.beta)
23
+ database_cleaner (~> 1.99.0.beta)
24
24
  mongo_mapper
25
- database_cleaner-mongoid (1.8.1)
26
- database_cleaner (~> 1.8.0)
27
- database_cleaner-mongo (~> 1.8.0)
25
+ database_cleaner-mongoid (1.99.0.beta)
26
+ database_cleaner (~> 1.99.0.beta)
28
27
  mongoid
29
- database_cleaner-moped (1.8.0)
30
- database_cleaner (~> 1.8.0)
28
+ database_cleaner-moped (1.99.0.beta)
29
+ database_cleaner (~> 1.99.0.beta)
31
30
  moped
32
- database_cleaner-neo4j (1.8.0)
33
- database_cleaner (~> 1.8.0)
31
+ database_cleaner-neo4j (1.99.0.beta)
32
+ database_cleaner (~> 1.99.0.beta)
34
33
  neo4j-core
35
- database_cleaner-ohm (1.8.1)
36
- database_cleaner (~> 1.8.0)
37
- database_cleaner-redis (~> 1.8.0)
34
+ database_cleaner-ohm (1.99.0.beta)
35
+ database_cleaner (~> 1.99.0.beta)
36
+ database_cleaner-redis (~> 1.99.0.beta)
38
37
  ohm
39
- database_cleaner-redis (1.8.0)
40
- database_cleaner (~> 1.8.0)
38
+ database_cleaner-redis (1.99.0.beta)
39
+ database_cleaner (~> 1.99.0.beta)
41
40
  redis
42
- database_cleaner-sequel (1.8.0)
43
- database_cleaner (~> 1.8.0)
41
+ database_cleaner-sequel (1.99.0.beta)
42
+ database_cleaner (~> 1.99.0.beta)
44
43
  sequel
45
44
 
46
45
  GEM
@@ -1,4 +1,21 @@
1
- == Development (master)
1
+ == 1.99.0 (v1-maintenance)
2
+
3
+ == Changes
4
+ * Remove unnecessary dependency on database_cleaner-mongo from database_cleaner-mongoid: @botandrose
5
+ * Enable the :cache_tables option for the mongo truncation strategy, and default to true: https://github.com/DatabaseCleaner/database_cleaner/pull/646"
6
+ * Introduce deletion aliases for truncation strategies for mongo, mongoid, and redis adapters. https://github.com/DatabaseCleaner/database_cleaner/pull/654
7
+ * Add new :db orm configuration key, for consistency with #db and #db=. https://github.com/DatabaseCleaner/database_cleaner/pull/649
8
+
9
+ == Deprecations
10
+ * Deprecate all #orm= setter methods: https://github.com/DatabaseCleaner/database_cleaner/pull/643
11
+ * Deprecate non-functional :reset_ids option in ActiveRecord truncation strategy: https://github.com/DatabaseCleaner/database_cleaner/issues/559
12
+ * 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"
13
+ * Deprecate redis truncation's #url method in favor of #db: @botandrose
14
+ * Deprecate mongo, mongoid, and redis truncation strategies in favor of deletion. https://github.com/DatabaseCleaner/database_cleaner/pull/654
15
+ * Deprecate :connection and :model configuration options in favor of :db for consistency: https://github.com/DatabaseCleaner/database_cleaner/pull/650
16
+
17
+ == Bugfixes
18
+ * Fix deprecation warning about `DatabaseCleaner.connections` to recommend a better alternative: https://github.com/DatabaseCleaner/database_cleaner/pull/656
2
19
 
3
20
  == 1.8.5 2020-05-04
4
21
 
@@ -306,10 +306,10 @@ DatabaseCleaner[:active_record].strategy = :transaction
306
306
  DatabaseCleaner[:mongo_mapper].strategy = :truncation
307
307
 
308
308
  # How to specify particular connections
309
- DatabaseCleaner[:active_record, { :connection => :two }]
309
+ DatabaseCleaner[:active_record, { :db => :two }]
310
310
 
311
311
  # You may also pass in the model directly:
312
- DatabaseCleaner[:active_record, { :model => ModelWithDifferentConnection }]
312
+ DatabaseCleaner[:active_record, { :db => ModelWithDifferentConnection }]
313
313
  ```
314
314
 
315
315
  Usage beyond that remains the same with `DatabaseCleaner.start` calling any setup on the different configured connections, and `DatabaseCleaner.clean` executing afterwards.
@@ -1,6 +1,7 @@
1
1
  require 'active_record/base'
2
2
  require 'database_cleaner/active_record/base'
3
3
  require 'active_record/connection_adapters/abstract_adapter'
4
+ require 'database_cleaner/deprecation'
4
5
 
5
6
  #Load available connection adapters
6
7
  %w(
@@ -233,6 +234,13 @@ module DatabaseCleaner::ActiveRecord
233
234
  include ::DatabaseCleaner::ActiveRecord::Base
234
235
  include ::DatabaseCleaner::Generic::Truncation
235
236
 
237
+ def initialize(*)
238
+ super
239
+ if !@reset_ids.nil?
240
+ DatabaseCleaner.deprecate "The `:reset_ids` option for the ActiveRecord truncation strategy has no effect, and is deprecated. It will be removed in database_cleaner 2.0 with no replacement."
241
+ end
242
+ end
243
+
236
244
  def clean
237
245
  connection = connection_class.connection
238
246
  connection.disable_referential_integrity do
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module ActiveRecord
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -3,6 +3,8 @@ require "database_cleaner"
3
3
  require "database_cleaner/couch_potato/base"
4
4
  require "database_cleaner/couch_potato/truncation"
5
5
 
6
+ DatabaseCleaner.deprecate "Due to lack of maintenance, the Couch Potato adapter for DatabaseCleaner is deprecated, and will be removed in v2.0 with no replacement. Contact us if you are interested in resurrecting this adapter!"
7
+
6
8
  module DatabaseCleaner::CouchPotato
7
9
  def self.default_strategy
8
10
  :truncation
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module CouchPotato
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -2,3 +2,5 @@ require "database_cleaner/data_mapper/version"
2
2
  require "database_cleaner"
3
3
  require "database_cleaner/data_mapper/transaction"
4
4
  require "database_cleaner/data_mapper/truncation"
5
+
6
+ DatabaseCleaner.deprecate "Due to lack of maintenance, the DataMapper adapter for DatabaseCleaner is deprecated, and will be removed in v2.0 with no replacement. Contact us if you are interested in resurrecting this adapter!"
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module DataMapper
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  require 'database_cleaner/mongo/version'
2
2
  require 'database_cleaner'
3
3
  require 'database_cleaner/mongo/truncation'
4
+ require 'database_cleaner/mongo/deletion'
4
5
 
5
6
  module DatabaseCleaner::Mongo
6
7
  def self.default_strategy
@@ -1,7 +1,7 @@
1
1
  module DatabaseCleaner
2
2
  module Mongo
3
3
  def self.available_strategies
4
- %w[truncation]
4
+ %w[truncation deletion]
5
5
  end
6
6
  module Base
7
7
  def db=(desired_db)
@@ -0,0 +1,8 @@
1
+ require 'database_cleaner/mongo/truncation'
2
+
3
+ module DatabaseCleaner
4
+ module Mongo
5
+ class Deletion < Truncation
6
+ end
7
+ end
8
+ end
@@ -2,6 +2,8 @@ require 'database_cleaner/mongo/base'
2
2
  require 'database_cleaner/generic/base'
3
3
  require 'database_cleaner/generic/truncation'
4
4
  require 'database_cleaner/mongo/truncation_mixin'
5
+ require 'database_cleaner/deprecation'
6
+
5
7
  module DatabaseCleaner
6
8
  module Mongo
7
9
  class Truncation
@@ -9,6 +11,14 @@ module DatabaseCleaner
9
11
  include ::DatabaseCleaner::Generic::Truncation
10
12
  include TruncationMixin
11
13
  include Base
14
+
15
+ def initialize(opts={})
16
+ super
17
+ if !opts.has_key?(:cache_tables) || opts[:cache_tables]
18
+ DatabaseCleaner.deprecate "The mongo adapter caches collection names between cleanings. However, this behavior can introduce test-order-dependency issues, because the collections that exist after the first test has executed are saved and used for the remainder of the suite. This means that any collection created during the subsequent tests are not cleaned! This is fixed in database_cleaner-mongo 2.0 by removing this collection caching functionality altogether. To ease the transition into this new behavior, it can be opted into by specifying the `:cache_tables` option to false: `DatabaseCleaner[:mongo].strategy = :deletion, cache_tables: false`. For more information, see https://github.com/DatabaseCleaner/database_cleaner/pull/646"
19
+ end
20
+ end
21
+
12
22
  private
13
23
 
14
24
  def database
@@ -16,11 +26,11 @@ module DatabaseCleaner
16
26
  end
17
27
 
18
28
  def collections_cache
19
- @@collections_cache ||= {}
29
+ @collections_cache ||= {}
20
30
  end
21
31
 
22
32
  def mongoid_collection_names
23
- @@mongoid_collection_names ||= Hash.new{|h,k| h[k]=[]}.tap do |names|
33
+ @mongoid_collection_names ||= Hash.new{|h,k| h[k]=[]}.tap do |names|
24
34
  ObjectSpace.each_object(Class) do |klass|
25
35
  (names[klass.db.name] << klass.collection_name) if valid_collection_name?(klass)
26
36
  end
@@ -28,17 +38,17 @@ module DatabaseCleaner
28
38
  end
29
39
 
30
40
  def not_caching(db_name, list)
31
- @@not_caching ||= {}
41
+ @not_caching ||= {}
32
42
 
33
- unless @@not_caching.has_key?(db_name)
34
- @@not_caching[db_name] = true
43
+ unless @not_caching.has_key?(db_name)
44
+ @not_caching[db_name] = true
35
45
 
36
46
  puts "Not caching collection names for db #{db_name}. Missing these from models: #{list}"
37
47
  end
38
48
  end
39
49
 
40
50
  def collections
41
- return collections_cache[database.name] if collections_cache.has_key?(database.name)
51
+ return collections_cache[database.name] if collections_cache.has_key?(database.name) && @cache_tables
42
52
  db_collections = database.collections.select { |c| c.name !~ /^system\./ }
43
53
 
44
54
  missing_collections = mongoid_collection_names[database.name] - db_collections.map(&:name)
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Mongo
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -2,3 +2,4 @@ require "database_cleaner/mongo_mapper/version"
2
2
  require "database_cleaner"
3
3
  require "database_cleaner/mongo_mapper/truncation"
4
4
 
5
+ DatabaseCleaner.deprecate "Due to lack of maintenance, the MongoMapper adapter for DatabaseCleaner is deprecated, and will be removed in v2.0 with no replacement. Contact us if you are interested in resurrecting this adapter!"
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module MongoMapper
3
- VERSION = "1.8.1"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  require "database_cleaner/mongoid/version"
2
2
  require "database_cleaner"
3
3
  require "database_cleaner/mongoid/truncation"
4
+ require "database_cleaner/mongoid/deletion"
4
5
 
5
6
  module DatabaseCleaner::Mongoid
6
7
  def self.default_strategy
@@ -2,7 +2,7 @@ require 'database_cleaner/generic/base'
2
2
  module DatabaseCleaner
3
3
  module Mongoid
4
4
  def self.available_strategies
5
- %w[truncation]
5
+ %w[truncation deletion]
6
6
  end
7
7
 
8
8
  module Base
@@ -0,0 +1,10 @@
1
+ require 'database_cleaner/mongoid/truncation'
2
+
3
+ module DatabaseCleaner
4
+ module Mongoid
5
+ class Deletion < Truncation
6
+ end
7
+ end
8
+ end
9
+
10
+
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Mongoid
3
- VERSION = "1.8.1"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -2,6 +2,8 @@ require "database_cleaner/moped/version"
2
2
  require "database_cleaner"
3
3
  require "database_cleaner/moped/truncation"
4
4
 
5
+ DatabaseCleaner.deprecate "Due to lack of maintenance, the Moped adapter for DatabaseCleaner is deprecated, and will be removed in v2.0 with no replacement. Contact us if you are interested in resurrecting this adapter!"
6
+
5
7
  module DatabaseCleaner::Moped
6
8
  def self.default_strategy
7
9
  :truncation
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Moped
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -4,3 +4,4 @@ require "database_cleaner/neo4j/transaction"
4
4
  require "database_cleaner/neo4j/truncation"
5
5
  require "database_cleaner/neo4j/deletion"
6
6
 
7
+ DatabaseCleaner.deprecate "Due to lack of maintenance, the Neo4j adapter for DatabaseCleaner is deprecated, and will be removed in v2.0 with no replacement. Contact us if you are interested in resurrecting this adapter!"
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Neo4j
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Ohm
3
- VERSION = "1.8.1"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  require "database_cleaner/redis/version"
2
2
  require "database_cleaner"
3
3
  require "database_cleaner/redis/truncation"
4
+ require "database_cleaner/redis/deletion"
4
5
 
@@ -1,9 +1,10 @@
1
1
  require 'database_cleaner/generic/base'
2
+ require 'database_cleaner/deprecation'
2
3
 
3
4
  module DatabaseCleaner
4
5
  module Redis
5
6
  def self.available_strategies
6
- %w{truncation}
7
+ %w{truncation deletion}
7
8
  end
8
9
 
9
10
  def self.default_strategy
@@ -21,7 +22,10 @@ module DatabaseCleaner
21
22
  @db ||= :default
22
23
  end
23
24
 
24
- alias url db
25
+ def url
26
+ DatabaseCleaner.deprecate "The redis deletion strategy's #url method is deprecated. It will be removed in database_cleaner-redis 2.0 in favor of #db."
27
+ db
28
+ end
25
29
 
26
30
  private
27
31
 
@@ -32,7 +36,7 @@ module DatabaseCleaner
32
36
  elsif db.is_a?(::Redis) # pass directly the connection
33
37
  db
34
38
  else
35
- ::Redis.new(:url => url)
39
+ ::Redis.new(:url => db)
36
40
  end
37
41
  end
38
42
  end
@@ -0,0 +1,9 @@
1
+ require 'database_cleaner/redis/truncation'
2
+
3
+ module DatabaseCleaner
4
+ module Redis
5
+ class Deletion < Truncation
6
+ end
7
+ end
8
+ end
9
+
@@ -19,7 +19,7 @@ module DatabaseCleaner
19
19
  else
20
20
  connection.flushdb
21
21
  end
22
- connection.quit unless url == :default
22
+ connection.quit unless db == :default
23
23
  end
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Redis
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module Sequel
3
- VERSION = "1.8.0"
3
+ VERSION = "1.99.0.beta"
4
4
  end
5
5
  end
@@ -15,7 +15,13 @@ module DatabaseCleaner
15
15
  def initialize(desired_orm = nil, opts = {})
16
16
  @orm_autodetector = ORMAutodetector.new
17
17
  self.orm = desired_orm
18
- self.db = opts[:connection] || opts[:model] if opts.has_key?(:connection) || opts.has_key?(:model)
18
+ if opts.has_key?(:model)
19
+ DatabaseCleaner.deprecate "Using the `:model` key in `DatabaseCleaner[:orm, model: ...]` is deprecated, and will be removed in database_cleaner 2.0. Please use the new `:db` key, instead, which has identical behavior: `DatabaseCleaner[:orm, db: ...]`."
20
+ end
21
+ if opts.has_key?(:connection)
22
+ DatabaseCleaner.deprecate "Using the `:connection` key in `DatabaseCleaner[:orm, connection: ...]` is deprecated, and will be removed in database_cleaner 2.0. Please use the new `:db` key, instead, which has identical behavior: `DatabaseCleaner[:orm, db: ...]`."
23
+ end
24
+ self.db = opts[:db] || opts[:connection] || opts[:model] if opts.has_key?(:db) || opts.has_key?(:connection) || opts.has_key?(:model)
19
25
  self.strategy = orm_module && orm_module.default_strategy
20
26
  Safeguard.new.run
21
27
  end
@@ -30,6 +36,13 @@ module DatabaseCleaner
30
36
 
31
37
  def strategy=(args)
32
38
  strategy, *strategy_args = args
39
+
40
+ if DatabaseCleaner.called_externally?(__FILE__, caller) \
41
+ && [:redis, :mongo, :mongoid].include?(orm) \
42
+ && strategy == :truncation
43
+ DatabaseCleaner.deprecate "The #{orm} adapter's :truncation strategy will be renamed to :deletion in database_cleaner-#{orm} 2.0. Please specify the :deletion adapter to resolve this deprecation notice."
44
+ end
45
+
33
46
  @strategy = if strategy.is_a?(Symbol)
34
47
  create_strategy(*args)
35
48
  elsif strategy_args.empty?
@@ -48,6 +61,9 @@ module DatabaseCleaner
48
61
  attr_reader :orm
49
62
 
50
63
  def orm=(desired_orm)
64
+ if DatabaseCleaner.called_externally?(__FILE__, caller)
65
+ DatabaseCleaner.deprecate "Calling `DatabaseCleaner[:orm].orm=` is deprecated, and will be removed in database_cleaner 2.0 with no replacement."
66
+ end
51
67
  @orm = (desired_orm || :autodetect).to_sym
52
68
  @orm = @orm_autodetector.orm if @orm == :autodetect
53
69
  end
@@ -21,6 +21,7 @@ module DatabaseCleaner
21
21
  end
22
22
 
23
23
  def orm=(orm)
24
+ DatabaseCleaner.deprecate "Calling `DatabaseCleaner.orm=` is deprecated, and will be removed in database_cleaner 2.0 with no replacement."
24
25
  add_cleaner(:autodetect) if none?
25
26
  values.each { |cleaner| cleaner.orm = orm }
26
27
  remove_duplicates
@@ -110,7 +111,7 @@ module DatabaseCleaner
110
111
 
111
112
  def connections
112
113
  if DatabaseCleaner.called_externally?(__FILE__, caller)
113
- DatabaseCleaner.deprecate "Calling `DatabaseCleaner.connections` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner.cleaners`, instead."
114
+ DatabaseCleaner.deprecate "Calling `DatabaseCleaner.connections` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner.cleaners.values`, instead."
114
115
  end
115
116
  add_cleaner(:autodetect) if @cleaners.none?
116
117
  @cleaners.values
@@ -1,3 +1,3 @@
1
1
  module DatabaseCleaner
2
- VERSION = "1.8.5"
2
+ VERSION = "1.99.0.beta"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.5
4
+ version: 1.99.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Mabey
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-05-04 00:00:00.000000000 Z
12
+ date: 2020-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -442,6 +442,7 @@ files:
442
442
  - adapters/database_cleaner-mongo/lib/database_cleaner-mongo.rb
443
443
  - adapters/database_cleaner-mongo/lib/database_cleaner/mongo.rb
444
444
  - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/base.rb
445
+ - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/deletion.rb
445
446
  - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation.rb
446
447
  - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation_mixin.rb
447
448
  - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/version.rb
@@ -453,6 +454,7 @@ files:
453
454
  - adapters/database_cleaner-mongoid/lib/database_cleaner-mongoid.rb
454
455
  - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid.rb
455
456
  - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/base.rb
457
+ - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/deletion.rb
456
458
  - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongo1_truncation_mixin.rb
457
459
  - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongo2_truncation_mixin.rb
458
460
  - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongoid_truncation_mixin.rb
@@ -478,6 +480,7 @@ files:
478
480
  - adapters/database_cleaner-redis/lib/database_cleaner-redis.rb
479
481
  - adapters/database_cleaner-redis/lib/database_cleaner/redis.rb
480
482
  - adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb
483
+ - adapters/database_cleaner-redis/lib/database_cleaner/redis/deletion.rb
481
484
  - adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb
482
485
  - adapters/database_cleaner-redis/lib/database_cleaner/redis/version.rb
483
486
  - adapters/database_cleaner-sequel/lib/database_cleaner-sequel.rb
@@ -518,9 +521,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
518
521
  version: 1.9.3
519
522
  required_rubygems_version: !ruby/object:Gem::Requirement
520
523
  requirements:
521
- - - ">="
524
+ - - ">"
522
525
  - !ruby/object:Gem::Version
523
- version: '0'
526
+ version: 1.3.1
524
527
  requirements: []
525
528
  rubygems_version: 3.0.8
526
529
  signing_key: