database_cleaner-mongo_mapper 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2ef88f4e53c088592feea13b9c59181073748f59274220d73b4d1e97d5beb00
4
- data.tar.gz: 2bb703668868bcfcd01644f9b72091cbb4de29a20590dc20632d6c155620e2bb
3
+ metadata.gz: f4b3be4063d4307fa595d58dd924ed66e09d36df7231ee946f7bbbeb43292ce3
4
+ data.tar.gz: 76d61e20f2c34b0f5eedef6990da0ff06fc7d4e92320f7fa672f9064c69c6eb9
5
5
  SHA512:
6
- metadata.gz: bf64e79abaddb321a6afdea143f905d83e2ab2c39690114ae29fe32b5f65fca1877cec6f3761e827f8ff9da4d72095c3d33b6769cf1e52531da901c3ca935a1a
7
- data.tar.gz: b67e345bb1a3be4f8f3f7a8651887b03b45d6d64845f5789ba03c522c90297f15ede21f5afc01662205c8053163f260aea4661e211b582566091a890ee54eeb5
6
+ metadata.gz: f92003ee2f78360d46aabb8e230d44e54d08af0bd3151f2528b1bcf246ab0a915d2fc093a9dcf588186783fa879ce4be4a8044f0a490451a5c92a02e4c5721b1
7
+ data.tar.gz: ec26501d384a1cc64bb8759587cf1052d2b6d60f1beed172c36659e2058c1c128bfc2bbad315ae26a350cf95f30c71321b2b798a92d1c6f0d3ef48841da2f90b
@@ -1,4 +1,3 @@
1
- sudo: false
2
1
  language: ruby
3
2
  rvm:
4
3
  - 2.2.9
@@ -1,27 +1,27 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- database_cleaner (1.8.0)
4
+ database_cleaner (1.8.1)
5
5
 
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- database_cleaner-mongo_mapper (1.8.0)
9
+ database_cleaner-mongo_mapper (1.8.1)
10
10
  database_cleaner (~> 1.8.0)
11
11
  mongo_mapper
12
12
 
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activemodel (3.0.0)
17
- activesupport (= 3.0.0)
16
+ activemodel (3.0.20)
17
+ activesupport (= 3.0.20)
18
18
  builder (~> 2.1.2)
19
- i18n (~> 0.4.1)
20
- activesupport (3.0.0)
19
+ i18n (~> 0.5.0)
20
+ activesupport (3.0.20)
21
21
  bson (1.12.5)
22
22
  builder (2.1.2)
23
23
  diff-lcs (1.3)
24
- i18n (0.4.2)
24
+ i18n (0.5.4)
25
25
  mongo (1.12.5)
26
26
  bson (= 1.12.5)
27
27
  mongo_mapper (0.12.0)
@@ -1,16 +1,32 @@
1
1
  require 'database_cleaner/mongo_mapper/base'
2
2
  require 'database_cleaner/generic/truncation'
3
- require 'database_cleaner/mongo/truncation_mixin'
4
3
 
5
4
  module DatabaseCleaner
6
5
  module MongoMapper
7
6
  class Truncation
8
7
  include ::DatabaseCleaner::MongoMapper::Base
9
8
  include ::DatabaseCleaner::Generic::Truncation
10
- include ::DatabaseCleaner::Mongo::TruncationMixin
11
-
9
+
10
+ def clean
11
+ if @only
12
+ collections.each { |c| c.send(truncate_method_name) if @only.include?(c.name) }
13
+ else
14
+ collections.each { |c| c.send(truncate_method_name) unless @tables_to_exclude.include?(c.name) }
15
+ end
16
+ true
17
+ end
18
+
12
19
  private
13
20
 
21
+ def collections
22
+ database.collections.select { |c| c.name !~ /^system\./ }
23
+ end
24
+
25
+ def truncate_method_name
26
+ # This constant only exists in the 2.x series.
27
+ defined?(::Mongo::VERSION) ? :delete_many : :remove
28
+ end
29
+
14
30
  def database
15
31
  ::MongoMapper.database
16
32
  end
@@ -1,5 +1,5 @@
1
1
  module DatabaseCleaner
2
2
  module MongoMapper
3
- VERSION = "1.8.0"
3
+ VERSION = "1.8.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_cleaner-mongo_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernesto Tagwerker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2020-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: database_cleaner