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 +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +7 -7
- data/lib/database_cleaner/mongo_mapper/truncation.rb +19 -3
- data/lib/database_cleaner/mongo_mapper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4b3be4063d4307fa595d58dd924ed66e09d36df7231ee946f7bbbeb43292ce3
|
4
|
+
data.tar.gz: 76d61e20f2c34b0f5eedef6990da0ff06fc7d4e92320f7fa672f9064c69c6eb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92003ee2f78360d46aabb8e230d44e54d08af0bd3151f2528b1bcf246ab0a915d2fc093a9dcf588186783fa879ce4be4a8044f0a490451a5c92a02e4c5721b1
|
7
|
+
data.tar.gz: ec26501d384a1cc64bb8759587cf1052d2b6d60f1beed172c36659e2058c1c128bfc2bbad315ae26a350cf95f30c71321b2b798a92d1c6f0d3ef48841da2f90b
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
database_cleaner (1.8.
|
4
|
+
database_cleaner (1.8.1)
|
5
5
|
|
6
6
|
PATH
|
7
7
|
remote: .
|
8
8
|
specs:
|
9
|
-
database_cleaner-mongo_mapper (1.8.
|
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.
|
17
|
-
activesupport (= 3.0.
|
16
|
+
activemodel (3.0.20)
|
17
|
+
activesupport (= 3.0.20)
|
18
18
|
builder (~> 2.1.2)
|
19
|
-
i18n (~> 0.
|
20
|
-
activesupport (3.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
|
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
|
-
|
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
|
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.
|
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
|
11
|
+
date: 2020-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_cleaner
|