database_cleaner 1.7.0 → 1.8.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTE.markdown +1 -2
  3. data/Gemfile.lock +130 -91
  4. data/History.rdoc +1 -1
  5. data/README.markdown +71 -226
  6. data/Rakefile +12 -8
  7. data/adapters/database_cleaner-active_record/lib/database_cleaner-active_record.rb +1 -0
  8. data/adapters/database_cleaner-active_record/lib/database_cleaner/active_record.rb +6 -0
  9. data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/base.rb +13 -4
  10. data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/deletion.rb +19 -19
  11. data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/transaction.rb +0 -0
  12. data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/truncation.rb +22 -19
  13. data/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/version.rb +5 -0
  14. data/adapters/database_cleaner-couch_potato/lib/database_cleaner-couch_potato.rb +1 -0
  15. data/adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato.rb +11 -0
  16. data/{lib → adapters/database_cleaner-couch_potato/lib}/database_cleaner/couch_potato/base.rb +0 -0
  17. data/{lib → adapters/database_cleaner-couch_potato/lib}/database_cleaner/couch_potato/truncation.rb +0 -0
  18. data/adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/version.rb +5 -0
  19. data/adapters/database_cleaner-data_mapper/lib/database_cleaner-data_mapper.rb +1 -0
  20. data/adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper.rb +4 -0
  21. data/{lib → adapters/database_cleaner-data_mapper/lib}/database_cleaner/data_mapper/base.rb +4 -0
  22. data/{lib → adapters/database_cleaner-data_mapper/lib}/database_cleaner/data_mapper/transaction.rb +0 -0
  23. data/{lib → adapters/database_cleaner-data_mapper/lib}/database_cleaner/data_mapper/truncation.rb +4 -3
  24. data/adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/version.rb +5 -0
  25. data/adapters/database_cleaner-mongo/lib/database_cleaner-mongo.rb +1 -0
  26. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo.rb +10 -0
  27. data/{lib → adapters/database_cleaner-mongo/lib}/database_cleaner/mongo/base.rb +0 -0
  28. data/{lib → adapters/database_cleaner-mongo/lib}/database_cleaner/mongo/truncation.rb +0 -0
  29. data/{lib → adapters/database_cleaner-mongo/lib}/database_cleaner/mongo/truncation_mixin.rb +0 -0
  30. data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo/version.rb +5 -0
  31. data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner-mongo_mapper.rb +1 -0
  32. data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper.rb +4 -0
  33. data/{lib → adapters/database_cleaner-mongo_mapper/lib}/database_cleaner/mongo_mapper/base.rb +4 -0
  34. data/{lib → adapters/database_cleaner-mongo_mapper/lib}/database_cleaner/mongo_mapper/truncation.rb +0 -0
  35. data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/version.rb +5 -0
  36. data/adapters/database_cleaner-mongoid/lib/database_cleaner-mongoid.rb +1 -0
  37. data/{lib → adapters/database_cleaner-mongoid/lib}/database_cleaner/mongo2/truncation_mixin.rb +0 -0
  38. data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid.rb +10 -0
  39. data/{lib → adapters/database_cleaner-mongoid/lib}/database_cleaner/mongoid/base.rb +0 -0
  40. data/{lib → adapters/database_cleaner-mongoid/lib}/database_cleaner/mongoid/truncation.rb +0 -0
  41. data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/version.rb +5 -0
  42. data/adapters/database_cleaner-moped/lib/database_cleaner-moped.rb +1 -0
  43. data/adapters/database_cleaner-moped/lib/database_cleaner/moped.rb +10 -0
  44. data/{lib → adapters/database_cleaner-moped/lib}/database_cleaner/moped/base.rb +1 -1
  45. data/{lib → adapters/database_cleaner-moped/lib}/database_cleaner/moped/truncation.rb +0 -0
  46. data/{lib → adapters/database_cleaner-moped/lib}/database_cleaner/moped/truncation_base.rb +4 -0
  47. data/adapters/database_cleaner-moped/lib/database_cleaner/moped/version.rb +5 -0
  48. data/adapters/database_cleaner-neo4j/lib/database_cleaner-neo4j.rb +1 -0
  49. data/adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j.rb +6 -0
  50. data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/base.rb +4 -0
  51. data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/deletion.rb +0 -0
  52. data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/transaction.rb +0 -0
  53. data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/truncation.rb +0 -0
  54. data/adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/version.rb +5 -0
  55. data/adapters/database_cleaner-ohm/lib/database_cleaner-ohm.rb +1 -0
  56. data/adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb +10 -0
  57. data/{lib → adapters/database_cleaner-ohm/lib}/database_cleaner/ohm/truncation.rb +4 -0
  58. data/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/version.rb +5 -0
  59. data/adapters/database_cleaner-redis/lib/database_cleaner-redis.rb +1 -0
  60. data/adapters/database_cleaner-redis/lib/database_cleaner/redis.rb +4 -0
  61. data/{lib → adapters/database_cleaner-redis/lib}/database_cleaner/redis/base.rb +4 -0
  62. data/{lib → adapters/database_cleaner-redis/lib}/database_cleaner/redis/truncation.rb +0 -0
  63. data/adapters/database_cleaner-redis/lib/database_cleaner/redis/version.rb +5 -0
  64. data/adapters/database_cleaner-sequel/lib/database_cleaner-sequel.rb +1 -0
  65. data/adapters/database_cleaner-sequel/lib/database_cleaner/sequel.rb +6 -0
  66. data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/base.rb +4 -0
  67. data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/deletion.rb +0 -0
  68. data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/transaction.rb +0 -0
  69. data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/truncation.rb +16 -15
  70. data/adapters/database_cleaner-sequel/lib/database_cleaner/sequel/version.rb +5 -0
  71. data/lib/database_cleaner.rb +36 -1
  72. data/lib/database_cleaner/base.rb +85 -103
  73. data/lib/database_cleaner/configuration.rb +93 -83
  74. data/lib/database_cleaner/deprecation.rb +21 -0
  75. data/lib/database_cleaner/null_strategy.rb +6 -6
  76. data/lib/database_cleaner/orm_autodetector.rb +31 -0
  77. data/lib/database_cleaner/safeguard.rb +38 -3
  78. data/lib/database_cleaner/spec.rb +2 -0
  79. data/lib/database_cleaner/spec/database_helper.rb +82 -0
  80. data/lib/database_cleaner/spec/shared_examples.rb +15 -0
  81. data/lib/database_cleaner/version.rb +3 -0
  82. metadata +111 -46
  83. data/VERSION.yml +0 -4
  84. data/lib/database_cleaner/mongo2/base.rb +0 -16
@@ -0,0 +1,15 @@
1
+ RSpec.shared_examples_for "a generic strategy" do
2
+ it { is_expected.to respond_to(:db) }
3
+ end
4
+
5
+ RSpec.shared_examples_for "a generic truncation strategy" do
6
+ it { is_expected.to respond_to(:start) }
7
+ it { is_expected.to respond_to(:clean) }
8
+ it { is_expected.to respond_to(:cleaning) }
9
+ end
10
+
11
+ RSpec.shared_examples_for "a generic transaction strategy" do
12
+ it { is_expected.to respond_to(:start) }
13
+ it { is_expected.to respond_to(:clean) }
14
+ it { is_expected.to respond_to(:cleaning) }
15
+ end
@@ -0,0 +1,3 @@
1
+ module DatabaseCleaner
2
+ VERSION = "1.8.0.beta"
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.7.0
4
+ version: 1.8.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: 2018-04-19 00:00:00.000000000 Z
12
+ date: 2020-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -179,6 +179,20 @@ dependencies:
179
179
  - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
+ - !ruby/object:Gem::Dependency
183
+ name: mongo
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: 1.12.0
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: 1.12.0
182
196
  - !ruby/object:Gem::Dependency
183
197
  name: moped
184
198
  requirement: !ruby/object:Gem::Requirement
@@ -264,19 +278,33 @@ dependencies:
264
278
  - !ruby/object:Gem::Version
265
279
  version: '0'
266
280
  - !ruby/object:Gem::Dependency
267
- name: rspec-rails
281
+ name: listen
268
282
  requirement: !ruby/object:Gem::Requirement
269
283
  requirements:
270
284
  - - "~>"
271
285
  - !ruby/object:Gem::Version
272
- version: 2.14.2
286
+ version: 3.0.0
273
287
  type: :development
274
288
  prerelease: false
275
289
  version_requirements: !ruby/object:Gem::Requirement
276
290
  requirements:
277
291
  - - "~>"
278
292
  - !ruby/object:Gem::Version
279
- version: 2.14.2
293
+ version: 3.0.0
294
+ - !ruby/object:Gem::Dependency
295
+ name: rspec
296
+ requirement: !ruby/object:Gem::Requirement
297
+ requirements:
298
+ - - ">="
299
+ - !ruby/object:Gem::Version
300
+ version: '0'
301
+ type: :development
302
+ prerelease: false
303
+ version_requirements: !ruby/object:Gem::Requirement
304
+ requirements:
305
+ - - ">="
306
+ - !ruby/object:Gem::Version
307
+ version: '0'
280
308
  - !ruby/object:Gem::Dependency
281
309
  name: cucumber
282
310
  requirement: !ruby/object:Gem::Requirement
@@ -375,9 +403,10 @@ dependencies:
375
403
  - - ">="
376
404
  - !ruby/object:Gem::Version
377
405
  version: '0'
378
- description: Strategies for cleaning databases. Can be used to ensure a clean state
406
+ description: Strategies for cleaning databases. Can be used to ensure a clean slate
379
407
  for testing.
380
- email: ernesto@ombulabs.com
408
+ email:
409
+ - ernesto@ombulabs.com
381
410
  executables: []
382
411
  extensions: []
383
412
  extra_rdoc_files:
@@ -392,50 +421,87 @@ files:
392
421
  - README.markdown
393
422
  - Rakefile
394
423
  - TODO
395
- - VERSION.yml
424
+ - adapters/database_cleaner-active_record/lib/database_cleaner-active_record.rb
425
+ - adapters/database_cleaner-active_record/lib/database_cleaner/active_record.rb
426
+ - adapters/database_cleaner-active_record/lib/database_cleaner/active_record/base.rb
427
+ - adapters/database_cleaner-active_record/lib/database_cleaner/active_record/deletion.rb
428
+ - adapters/database_cleaner-active_record/lib/database_cleaner/active_record/transaction.rb
429
+ - adapters/database_cleaner-active_record/lib/database_cleaner/active_record/truncation.rb
430
+ - adapters/database_cleaner-active_record/lib/database_cleaner/active_record/version.rb
431
+ - adapters/database_cleaner-couch_potato/lib/database_cleaner-couch_potato.rb
432
+ - adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato.rb
433
+ - adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/base.rb
434
+ - adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/truncation.rb
435
+ - adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/version.rb
436
+ - adapters/database_cleaner-data_mapper/lib/database_cleaner-data_mapper.rb
437
+ - adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper.rb
438
+ - adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/base.rb
439
+ - adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/transaction.rb
440
+ - adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/truncation.rb
441
+ - adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/version.rb
442
+ - adapters/database_cleaner-mongo/lib/database_cleaner-mongo.rb
443
+ - adapters/database_cleaner-mongo/lib/database_cleaner/mongo.rb
444
+ - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/base.rb
445
+ - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation.rb
446
+ - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation_mixin.rb
447
+ - adapters/database_cleaner-mongo/lib/database_cleaner/mongo/version.rb
448
+ - adapters/database_cleaner-mongo_mapper/lib/database_cleaner-mongo_mapper.rb
449
+ - adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper.rb
450
+ - adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/base.rb
451
+ - adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/truncation.rb
452
+ - adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/version.rb
453
+ - adapters/database_cleaner-mongoid/lib/database_cleaner-mongoid.rb
454
+ - adapters/database_cleaner-mongoid/lib/database_cleaner/mongo2/truncation_mixin.rb
455
+ - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid.rb
456
+ - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/base.rb
457
+ - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
458
+ - adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/version.rb
459
+ - adapters/database_cleaner-moped/lib/database_cleaner-moped.rb
460
+ - adapters/database_cleaner-moped/lib/database_cleaner/moped.rb
461
+ - adapters/database_cleaner-moped/lib/database_cleaner/moped/base.rb
462
+ - adapters/database_cleaner-moped/lib/database_cleaner/moped/truncation.rb
463
+ - adapters/database_cleaner-moped/lib/database_cleaner/moped/truncation_base.rb
464
+ - adapters/database_cleaner-moped/lib/database_cleaner/moped/version.rb
465
+ - adapters/database_cleaner-neo4j/lib/database_cleaner-neo4j.rb
466
+ - adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j.rb
467
+ - adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/base.rb
468
+ - adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/deletion.rb
469
+ - adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/transaction.rb
470
+ - adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/truncation.rb
471
+ - adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/version.rb
472
+ - adapters/database_cleaner-ohm/lib/database_cleaner-ohm.rb
473
+ - adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb
474
+ - adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb
475
+ - adapters/database_cleaner-ohm/lib/database_cleaner/ohm/version.rb
476
+ - adapters/database_cleaner-redis/lib/database_cleaner-redis.rb
477
+ - adapters/database_cleaner-redis/lib/database_cleaner/redis.rb
478
+ - adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb
479
+ - adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb
480
+ - adapters/database_cleaner-redis/lib/database_cleaner/redis/version.rb
481
+ - adapters/database_cleaner-sequel/lib/database_cleaner-sequel.rb
482
+ - adapters/database_cleaner-sequel/lib/database_cleaner/sequel.rb
483
+ - adapters/database_cleaner-sequel/lib/database_cleaner/sequel/base.rb
484
+ - adapters/database_cleaner-sequel/lib/database_cleaner/sequel/deletion.rb
485
+ - adapters/database_cleaner-sequel/lib/database_cleaner/sequel/transaction.rb
486
+ - adapters/database_cleaner-sequel/lib/database_cleaner/sequel/truncation.rb
487
+ - adapters/database_cleaner-sequel/lib/database_cleaner/sequel/version.rb
396
488
  - cucumber.yml
397
489
  - lib/database_cleaner.rb
398
- - lib/database_cleaner/active_record/base.rb
399
- - lib/database_cleaner/active_record/deletion.rb
400
- - lib/database_cleaner/active_record/transaction.rb
401
- - lib/database_cleaner/active_record/truncation.rb
402
490
  - lib/database_cleaner/base.rb
403
491
  - lib/database_cleaner/configuration.rb
404
- - lib/database_cleaner/couch_potato/base.rb
405
- - lib/database_cleaner/couch_potato/truncation.rb
406
492
  - lib/database_cleaner/cucumber.rb
407
- - lib/database_cleaner/data_mapper/base.rb
408
- - lib/database_cleaner/data_mapper/transaction.rb
409
- - lib/database_cleaner/data_mapper/truncation.rb
493
+ - lib/database_cleaner/deprecation.rb
410
494
  - lib/database_cleaner/generic/base.rb
411
495
  - lib/database_cleaner/generic/transaction.rb
412
496
  - lib/database_cleaner/generic/truncation.rb
413
- - lib/database_cleaner/mongo/base.rb
414
- - lib/database_cleaner/mongo/truncation.rb
415
- - lib/database_cleaner/mongo/truncation_mixin.rb
416
- - lib/database_cleaner/mongo2/base.rb
417
- - lib/database_cleaner/mongo2/truncation_mixin.rb
418
- - lib/database_cleaner/mongo_mapper/base.rb
419
- - lib/database_cleaner/mongo_mapper/truncation.rb
420
- - lib/database_cleaner/mongoid/base.rb
421
- - lib/database_cleaner/mongoid/truncation.rb
422
- - lib/database_cleaner/moped/base.rb
423
- - lib/database_cleaner/moped/truncation.rb
424
- - lib/database_cleaner/moped/truncation_base.rb
425
- - lib/database_cleaner/neo4j/base.rb
426
- - lib/database_cleaner/neo4j/deletion.rb
427
- - lib/database_cleaner/neo4j/transaction.rb
428
- - lib/database_cleaner/neo4j/truncation.rb
429
497
  - lib/database_cleaner/null_strategy.rb
430
- - lib/database_cleaner/ohm/truncation.rb
431
- - lib/database_cleaner/redis/base.rb
432
- - lib/database_cleaner/redis/truncation.rb
498
+ - lib/database_cleaner/orm_autodetector.rb
433
499
  - lib/database_cleaner/safeguard.rb
434
- - lib/database_cleaner/sequel/base.rb
435
- - lib/database_cleaner/sequel/deletion.rb
436
- - lib/database_cleaner/sequel/transaction.rb
437
- - lib/database_cleaner/sequel/truncation.rb
438
- homepage: http://github.com/DatabaseCleaner/database_cleaner
500
+ - lib/database_cleaner/spec.rb
501
+ - lib/database_cleaner/spec/database_helper.rb
502
+ - lib/database_cleaner/spec/shared_examples.rb
503
+ - lib/database_cleaner/version.rb
504
+ homepage: https://github.com/DatabaseCleaner/database_cleaner
439
505
  licenses:
440
506
  - MIT
441
507
  metadata: {}
@@ -450,14 +516,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
450
516
  version: 1.9.3
451
517
  required_rubygems_version: !ruby/object:Gem::Requirement
452
518
  requirements:
453
- - - ">="
519
+ - - ">"
454
520
  - !ruby/object:Gem::Version
455
- version: '0'
521
+ version: 1.3.1
456
522
  requirements: []
457
- rubyforge_project:
458
- rubygems_version: 2.7.3
523
+ rubygems_version: 3.0.4
459
524
  signing_key:
460
525
  specification_version: 4
461
- summary: Strategies for cleaning databases. Can be used to ensure a clean state for
526
+ summary: Strategies for cleaning databases. Can be used to ensure a clean slate for
462
527
  testing.
463
528
  test_files: []
@@ -1,4 +0,0 @@
1
- ---
2
- :major: 1
3
- :minor: 7
4
- :patch: 0
@@ -1,16 +0,0 @@
1
- module DatabaseCleaner
2
- module Mongo2
3
- def self.available_strategies
4
- %w[truncation]
5
- end
6
- module Base
7
- def db=(desired_db)
8
- @db = desired_db
9
- end
10
-
11
- def db
12
- @db || raise("You have not specified a database. (see Mongo2::Database)")
13
- end
14
- end
15
- end
16
- end