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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2014e2b6a88fc052138027fe636b0832e1e82ed0da858fdfc6b4c57e25b4c640
4
- data.tar.gz: 27a439c3e5fe70c98c49bd79be9c534ec35695a6f36ab5eba6fd272fc0a30e39
3
+ metadata.gz: 542128460dcf57ee3cbb1abb9600c6f71c94e76a00d0e56b2ef1cd9d03eb301e
4
+ data.tar.gz: 9448f484a16c73734c838eaa52b09b26cbe7cca4ded33fc0a42cc64f38b378d0
5
5
  SHA512:
6
- metadata.gz: 68441f1d78a2dec098872b0d0cf37823c853ff6b2377229b5e81396ff31b4927f48c567b4ab163dd583d6b455050c312d555c87b0ff870c9e5494c9ac06146cb
7
- data.tar.gz: 0ddef43b158cc15263307bbf5bae0c92363fa6e882b5f7cc1ccb5cf7831d092c4da8549cd21c8bfca0be955299105b4023e333cc68c5c3180206ff3b79e6aea0
6
+ metadata.gz: 1ebe87490fea5226d40c7afae00971818ebaeda43a90cd4d1bd2551cbb755f1a4206db28221639ad3184034db3c3fc60d3be96062e84d3e974a11dd6300f29bd
7
+ data.tar.gz: 288b78f19d594b92ce5001ee3750b64ffd78da3e7b5cc66cd07dfd68d8e4555738d5895581ed99eaaf6c8660b2882057457dd8ed35086c8404affaed2b85dcf2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- database_cleaner (1.8.3)
4
+ database_cleaner (1.8.4)
5
5
 
6
6
  PATH
7
7
  remote: adapters
@@ -1,5 +1,10 @@
1
1
  == Development (master)
2
2
 
3
+ == 1.8.4 2020-04-02
4
+
5
+ === Bug Fixes
6
+ * Fix false positive deprecation warnings on Windows: https://github.com/DatabaseCleaner/database_cleaner/pull/633
7
+
3
8
  == 1.8.3 2020-02-18
4
9
 
5
10
  === Bug Fixes
@@ -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 = {}
@@ -1,3 +1,3 @@
1
1
  module DatabaseCleaner
2
- VERSION = "1.8.3"
2
+ VERSION = "1.8.4"
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.3
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-02-18 00:00:00.000000000 Z
12
+ date: 2020-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake