database_cleaner 1.8.3 → 1.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/History.rdoc +5 -0
- data/lib/database_cleaner/base.rb +3 -7
- data/lib/database_cleaner/configuration.rb +3 -9
- data/lib/database_cleaner/deprecation.rb +5 -0
- data/lib/database_cleaner/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: 542128460dcf57ee3cbb1abb9600c6f71c94e76a00d0e56b2ef1cd9d03eb301e
|
4
|
+
data.tar.gz: 9448f484a16c73734c838eaa52b09b26cbe7cca4ded33fc0a42cc64f38b378d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ebe87490fea5226d40c7afae00971818ebaeda43a90cd4d1bd2551cbb755f1a4206db28221639ad3184034db3c3fc60d3be96062e84d3e974a11dd6300f29bd
|
7
|
+
data.tar.gz: 288b78f19d594b92ce5001ee3750b64ffd78da3e7b5cc66cd07dfd68d8e4555738d5895581ed99eaaf6c8660b2882057457dd8ed35086c8404affaed2b85dcf2
|
data/Gemfile.lock
CHANGED
data/History.rdoc
CHANGED
@@ -87,14 +87,14 @@ module DatabaseCleaner
|
|
87
87
|
# TODO privatize the following methods in 2.0
|
88
88
|
|
89
89
|
def strategy_db=(desired_db)
|
90
|
-
if called_externally?(caller)
|
90
|
+
if DatabaseCleaner.called_externally?(__FILE__, caller)
|
91
91
|
DatabaseCleaner.deprecate "Calling `DatabaseCleaner[...].strategy_db=` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner[...].db=` instead."
|
92
92
|
end
|
93
93
|
set_strategy_db(strategy, desired_db)
|
94
94
|
end
|
95
95
|
|
96
96
|
def set_strategy_db(strategy, desired_db)
|
97
|
-
if called_externally?(caller)
|
97
|
+
if DatabaseCleaner.called_externally?(__FILE__, caller)
|
98
98
|
DatabaseCleaner.deprecate "Calling `DatabaseCleaner[...].set_strategy_db=` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner[...].db=` instead."
|
99
99
|
end
|
100
100
|
if strategy.respond_to? :db=
|
@@ -105,7 +105,7 @@ module DatabaseCleaner
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def create_strategy(*args)
|
108
|
-
if called_externally?(caller)
|
108
|
+
if DatabaseCleaner.called_externally?(__FILE__, caller)
|
109
109
|
DatabaseCleaner.deprecate "Calling `DatabaseCleaner[...].create_strategy` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner[...].strategy=` instead."
|
110
110
|
end
|
111
111
|
strategy, *strategy_args = args
|
@@ -149,9 +149,5 @@ module DatabaseCleaner
|
|
149
149
|
rescue LoadError
|
150
150
|
raise UnknownStrategySpecified, "The '#{strategy}' strategy does not exist for the #{orm} ORM! Available strategies: #{orm_module.available_strategies.join(', ')}"
|
151
151
|
end
|
152
|
-
|
153
|
-
def called_externally?(caller)
|
154
|
-
__FILE__ != caller.first.split(":").first
|
155
|
-
end
|
156
152
|
end
|
157
153
|
end
|
@@ -109,7 +109,7 @@ module DatabaseCleaner
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def connections
|
112
|
-
if called_externally?(caller)
|
112
|
+
if DatabaseCleaner.called_externally?(__FILE__, caller)
|
113
113
|
DatabaseCleaner.deprecate "Calling `DatabaseCleaner.connections` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner.cleaners`, instead."
|
114
114
|
end
|
115
115
|
add_cleaner(:autodetect) if @cleaners.none?
|
@@ -119,23 +119,17 @@ module DatabaseCleaner
|
|
119
119
|
# TODO privatize the following methods in 2.0
|
120
120
|
|
121
121
|
def add_cleaner(orm, opts = {})
|
122
|
-
if called_externally?(caller)
|
122
|
+
if DatabaseCleaner.called_externally?(__FILE__, caller)
|
123
123
|
DatabaseCleaner.deprecate "Calling `DatabaseCleaner.add_cleaner` is deprecated, and will be removed in database_cleaner 2.0. Use `DatabaseCleaner.[]`, instead."
|
124
124
|
end
|
125
125
|
@cleaners.add_cleaner(orm, opts = {})
|
126
126
|
end
|
127
127
|
|
128
128
|
def remove_duplicates
|
129
|
-
if called_externally?(caller)
|
129
|
+
if DatabaseCleaner.called_externally?(__FILE__, caller)
|
130
130
|
DatabaseCleaner.deprecate "Calling `DatabaseCleaner.remove_duplicates` is deprecated, and will be removed in database_cleaner 2.0 with no replacement."
|
131
131
|
end
|
132
132
|
@cleaners.remove_duplicates
|
133
133
|
end
|
134
|
-
|
135
|
-
private
|
136
|
-
|
137
|
-
def called_externally?(caller)
|
138
|
-
__FILE__ != caller.first.split(":").first
|
139
|
-
end
|
140
134
|
end
|
141
135
|
end
|
@@ -6,6 +6,11 @@ module DatabaseCleaner
|
|
6
6
|
end
|
7
7
|
module_function :deprecate
|
8
8
|
|
9
|
+
def called_externally?(file, caller)
|
10
|
+
file != caller.first[/^(.+\.rb):\d+/, 1]
|
11
|
+
end
|
12
|
+
module_function :called_externally?
|
13
|
+
|
9
14
|
class Deprecator
|
10
15
|
def initialize
|
11
16
|
@methods_already_warned = {}
|
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.
|
4
|
+
version: 1.8.4
|
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-
|
12
|
+
date: 2020-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|