database_cleaner 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/History.rdoc +6 -1
- data/README.markdown +2 -1
- data/lib/database_cleaner/base.rb +4 -3
- data/lib/database_cleaner/orm_autodetector.rb +15 -6
- 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: 34d0bf0798c85c01252ca0d55beebb591438e41967606e0e0197b5e1789341f5
|
4
|
+
data.tar.gz: 20008c1f0341e3f10da0e9bdd083f03122e0fe0d09c12ae597190109cc5bbf3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4aba72c021caf79c7a22ab362ff7c3907b711997ffebb08ac091accacca5b5c81e73485d40f0376be89f72333fc0b77b06c8ff9e426797450c1a532fe77cc77
|
7
|
+
data.tar.gz: c1a015ca1eec638d714b65270e1294a1065f7a0b4d792d260a632daafb84930e14a8f149d6880a8c6c91c72359eca1c0c63be9b7c2dd16d9b4e4f04fe3ed6079
|
data/Gemfile.lock
CHANGED
data/History.rdoc
CHANGED
@@ -2,7 +2,12 @@
|
|
2
2
|
=== Bug Fixes
|
3
3
|
=== Changes
|
4
4
|
|
5
|
-
== 1.8.
|
5
|
+
== 1.8.1 2020-01-30
|
6
|
+
|
7
|
+
=== Bug Fixes
|
8
|
+
* Remove undeclared active_support dependency: https://github.com/DatabaseCleaner/database_cleaner/pull/612
|
9
|
+
|
10
|
+
== 1.8.0 2020-01-29
|
6
11
|
|
7
12
|
=== Bug Fixes
|
8
13
|
* Fix MySQL deprecation warnings with Rails 5: https://github.com/DatabaseCleaner/database_cleaner/pull/574
|
data/README.markdown
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
<!--
|
1
2
|
**If you're viewing this at https://github.com/DatabaseCleaner/database_cleaner,
|
2
3
|
you're reading the documentation for the `master` branch.
|
3
4
|
[View documentation for the latest release
|
4
5
|
(1.7.0).](https://github.com/DatabaseCleaner/database_cleaner/blob/v1.7.0/README.markdown)**
|
5
|
-
|
6
|
+
-->
|
6
7
|
# Database Cleaner
|
7
8
|
|
8
9
|
[](https://travis-ci.org/DatabaseCleaner/database_cleaner)
|
@@ -2,7 +2,6 @@ require 'database_cleaner/deprecation'
|
|
2
2
|
require 'database_cleaner/null_strategy'
|
3
3
|
require 'database_cleaner/safeguard'
|
4
4
|
require 'database_cleaner/orm_autodetector'
|
5
|
-
require 'active_support/core_ext/string/inflections'
|
6
5
|
require 'forwardable'
|
7
6
|
|
8
7
|
module DatabaseCleaner
|
@@ -119,11 +118,13 @@ module DatabaseCleaner
|
|
119
118
|
return unless [:active_record, :data_mapper, :mongo, :mongoid, :mongo_mapper, :moped, :couch_potato, :sequel, :ohm, :redis, :neo4j].include?(orm)
|
120
119
|
$LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/../../adapters/database_cleaner-#{orm}/lib")
|
121
120
|
require "database_cleaner/#{orm}"
|
122
|
-
|
121
|
+
orm_module_name = ORMAutodetector::ORMS[orm]
|
122
|
+
DatabaseCleaner.const_get(orm_module_name)
|
123
123
|
end
|
124
124
|
|
125
125
|
def orm_strategy(strategy)
|
126
|
-
|
126
|
+
strategy_module_name = strategy.to_s.capitalize
|
127
|
+
orm_module.const_get(strategy_module_name)
|
127
128
|
rescue NameError
|
128
129
|
if orm != :active_record
|
129
130
|
DatabaseCleaner.deprecate <<-TEXT
|
@@ -1,13 +1,22 @@
|
|
1
|
-
require 'active_support/core_ext/string/inflections'
|
2
|
-
|
3
1
|
module DatabaseCleaner
|
4
2
|
class ORMAutodetector
|
5
|
-
ORMS =
|
3
|
+
ORMS = {
|
4
|
+
active_record: "ActiveRecord",
|
5
|
+
data_mapper: "DataMapper",
|
6
|
+
mongo_mapper: "MongoMapper",
|
7
|
+
mongoid: "Mongoid",
|
8
|
+
couch_potato: "CouchPotato",
|
9
|
+
sequel: "Sequel",
|
10
|
+
moped: "Moped",
|
11
|
+
ohm: "Ohm",
|
12
|
+
redis: "Redis",
|
13
|
+
neo4j: "Neo4j",
|
14
|
+
}
|
6
15
|
|
7
16
|
def orm
|
8
17
|
@autodetected = true
|
9
18
|
autodetected_orm or raise no_orm_detected_error
|
10
|
-
autodetected_orm.
|
19
|
+
ORMS.key(autodetected_orm.to_s)
|
11
20
|
end
|
12
21
|
|
13
22
|
def autodetected?
|
@@ -17,13 +26,13 @@ module DatabaseCleaner
|
|
17
26
|
private
|
18
27
|
|
19
28
|
def autodetected_orm
|
20
|
-
ORMS.find do |orm|
|
29
|
+
ORMS.values.find do |orm|
|
21
30
|
Kernel.const_get(orm) rescue next
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
25
34
|
def no_orm_detected_error
|
26
|
-
orm_list = ORMS.join(", ").sub(ORMS.last, "or #{ORMS.last}")
|
35
|
+
orm_list = ORMS.values.join(", ").sub(ORMS.values.last, "or #{ORMS.values.last}")
|
27
36
|
NoORMDetected.new("No known ORM was detected! Is #{orm_list} loaded?")
|
28
37
|
end
|
29
38
|
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.
|
4
|
+
version: 1.8.1
|
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-01-
|
12
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|