database_cleaner-active_record 2.1.0 → 2.2.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/.github/workflows/ci.yml +35 -28
- data/Appraisals +11 -12
- data/CHANGELOG.md +21 -0
- data/README.md +6 -2
- data/database_cleaner-active_record.gemspec +1 -0
- data/gemfiles/rails_6.1.gemfile +1 -7
- data/gemfiles/rails_7.0.gemfile +1 -0
- data/gemfiles/rails_7.1.gemfile +2 -1
- data/gemfiles/{rails_5.1.gemfile → rails_7.2.gemfile} +1 -1
- data/gemfiles/{rails_5.2.gemfile → rails_edge.gemfile} +1 -1
- data/lib/database_cleaner/active_record/base.rb +3 -2
- data/lib/database_cleaner/active_record/deletion.rb +18 -7
- data/lib/database_cleaner/active_record/transaction.rb +12 -6
- data/lib/database_cleaner/active_record/truncation.rb +21 -14
- data/lib/database_cleaner/active_record/version.rb +1 -1
- data/lib/database_cleaner/active_record.rb +9 -5
- metadata +19 -10
- data/.travis.yml +0 -25
- data/gemfiles/rails_6.0.gemfile +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c30dde1a5104c77a1bf907b7d5d5bb8aa187776246b8b02639d0ea8e352fd1d
|
4
|
+
data.tar.gz: 982552da4f5c169ddf5a0d16c9703eb2b73623e1330c476dd8116683409951fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d46caf98521a0a53b67655e1eb55947108b13cf37b2ce8398fcdc53f34b334c51fa34acf65135c04689a1022394a396dc0648c0406d2d92a147c005bf488551
|
7
|
+
data.tar.gz: fd15224bc593acc67996d9a2c04840df1e95d3eafb49a68ba6d73dd64c0e92cd6984d9bb7b972ed7d6ef6063d67cd918ba1474630c8675520e932ef57c267108
|
data/.github/workflows/ci.yml
CHANGED
@@ -4,44 +4,51 @@ on: [push, pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
test:
|
7
|
-
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }}'
|
7
|
+
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }}, Channel: ${{ matrix.channel }}'
|
8
8
|
runs-on: 'ubuntu-22.04'
|
9
9
|
strategy:
|
10
10
|
fail-fast: false
|
11
11
|
matrix:
|
12
|
-
ruby: ['3.
|
13
|
-
rails: ['
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- ruby: '
|
18
|
-
rails: '
|
12
|
+
ruby: ['3.3', '3.2', '3.1']
|
13
|
+
rails: ['6.1', '7.0', '7.1', '7.2']
|
14
|
+
channel: ['stable']
|
15
|
+
|
16
|
+
include:
|
17
|
+
- ruby: 'ruby-head'
|
18
|
+
rails: 'edge'
|
19
|
+
channel: 'experimental'
|
20
|
+
- ruby: 'ruby-head'
|
21
|
+
rails: '7.2'
|
22
|
+
channel: 'experimental'
|
23
|
+
- ruby: 'ruby-head'
|
24
|
+
rails: '7.1'
|
25
|
+
channel: 'experimental'
|
26
|
+
|
27
|
+
- ruby: '3.3'
|
28
|
+
rails: 'edge'
|
29
|
+
channel: 'experimental'
|
19
30
|
- ruby: '3.2'
|
20
|
-
rails: '
|
31
|
+
rails: 'edge'
|
32
|
+
channel: 'experimental'
|
33
|
+
- ruby: '3.1'
|
34
|
+
rails: 'edge'
|
35
|
+
channel: 'experimental'
|
36
|
+
|
37
|
+
exclude:
|
38
|
+
- ruby: '3.3'
|
39
|
+
rails: '7.0' # TODO: works on 7-0-stable branch, remove after a 7.0.x patch release
|
40
|
+
- ruby: '3.3'
|
41
|
+
rails: '6.1'
|
42
|
+
|
21
43
|
- ruby: '3.2'
|
22
44
|
rails: '6.1'
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
rails: '5.2'
|
27
|
-
- ruby: '3.1'
|
28
|
-
rails: '6.0'
|
29
|
-
- ruby: '3.0'
|
30
|
-
rails: '5.1'
|
31
|
-
- ruby: '3.0'
|
32
|
-
rails: '5.2'
|
33
|
-
- ruby: '2.6'
|
34
|
-
rails: '7.0'
|
35
|
-
- ruby: '2.5'
|
36
|
-
rails: '7.0'
|
37
|
-
- ruby: '2.5'
|
38
|
-
rails: '7.1'
|
39
|
-
- ruby: '2.6'
|
40
|
-
rails: '7.1'
|
45
|
+
|
46
|
+
continue-on-error: ${{ matrix.channel != 'stable' }}
|
47
|
+
|
41
48
|
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
42
49
|
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
|
43
50
|
steps:
|
44
|
-
- uses: actions/checkout@
|
51
|
+
- uses: actions/checkout@v4
|
45
52
|
- name: Set up Ruby ${{ matrix.ruby }}
|
46
53
|
uses: ruby/setup-ruby@v1
|
47
54
|
with:
|
data/Appraisals
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
appraise "rails-5.1" do
|
2
|
-
gem "rails", "~> 5.1.0"
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise "rails-5.2" do
|
6
|
-
gem "rails", "~> 5.2.0"
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise "rails-6.0" do
|
10
|
-
gem "rails", "~> 6.0.0"
|
11
|
-
end
|
12
|
-
|
13
1
|
appraise "rails-6.1" do
|
14
2
|
gem "rails", "~> 6.1.0"
|
3
|
+
gem "sqlite3", "~> 1.5"
|
15
4
|
end
|
16
5
|
|
17
6
|
appraise "rails-7.0" do
|
18
7
|
gem "rails", "~> 7.0.0"
|
8
|
+
gem "sqlite3", "~> 1.7"
|
19
9
|
end
|
20
10
|
|
21
11
|
appraise "rails-7.1" do
|
22
12
|
gem "rails", "~> 7.1.0"
|
13
|
+
gem "sqlite3", "~> 1.7" # FIXME: remove after rails/rails#51592
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise "rails-7.2" do
|
17
|
+
gem "rails", "~> 7.2.0.beta2"
|
18
|
+
end
|
19
|
+
|
20
|
+
appraise "rails-edge" do
|
21
|
+
gem "rails", github: "rails/rails"
|
23
22
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Development (unreleased)
|
2
2
|
|
3
|
+
## v2.2.1 2025-05-13
|
4
|
+
|
5
|
+
* https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/111 by @tagliala
|
6
|
+
* https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/104 by @fatkodima
|
7
|
+
* https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/118 by @pat, @thegeorgeous, and @nnishimura
|
8
|
+
|
9
|
+
## v2.2.0 2024-07-12
|
10
|
+
|
11
|
+
* Fix "ERROR: currval of sequence" in Postgres adapter: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/103
|
12
|
+
* Use lock synchronize on transaction callback: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/73
|
13
|
+
* Stop testing with EOLed Ruby & Rails versions: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/105
|
14
|
+
* Fix compatibility issue with Rails 7.2: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/107
|
15
|
+
* Fix typo in truncation methods: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/94/files
|
16
|
+
* Address deprecation of ActiveRecord::Base.connection in Rails 7.2: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/102
|
17
|
+
* Support Rails 7.2+: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/101
|
18
|
+
* Fix reset_ids test with Trilogy adapter: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/93
|
19
|
+
* Implement resetting ids for deletion strategy: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/71
|
20
|
+
* Avoid loading ActiveRecord::Base early: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/91
|
21
|
+
* Fix specs to account for trilogy: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/88
|
22
|
+
* Add basic support for trilogy: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/85
|
23
|
+
|
3
24
|
## v2.1.0 2023-02-17
|
4
25
|
|
5
26
|
* Add Ruby 3.2 to CI matrix: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/79
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Clean your ActiveRecord databases with Database Cleaner.
|
|
8
8
|
|
9
9
|
See https://github.com/DatabaseCleaner/database_cleaner for more information.
|
10
10
|
|
11
|
-
For support or to discuss development please use
|
11
|
+
For support or to discuss development please use GitHub Issues.
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
@@ -61,6 +61,10 @@ DatabaseCleaner[:active_record].strategy = DatabaseCleaner::ActiveRecord::Deleti
|
|
61
61
|
|
62
62
|
* `:cache_tables` - When set to `true` the list of tables to truncate or delete from will only be read from the DB once, otherwise it will be read before each cleanup run. Set this to `false` if (1) you create and drop tables in your tests, or (2) you change Postgres schemas (`ActiveRecord::Base.connection.schema_search_path`) in your tests (for example, in a multitenancy setup with each tenant in a different Postgres schema). Defaults to `true`.
|
63
63
|
|
64
|
+
* `:reset_ids` - Only valid for deletion strategy, when set to `true` resets ids to 1 after each table is cleaned.
|
65
|
+
|
66
|
+
* `:truncate_option` - Only valid for PostgreSQL. Acceptable values are `:restrict` and `:cascade`. Default is `:restrict`
|
67
|
+
|
64
68
|
## Adapter configuration options
|
65
69
|
|
66
70
|
`#db` defaults to the default ActiveRecord database, but can be specified manually in a few ways:
|
@@ -95,7 +99,7 @@ You can also add this parameter to your database.yml file:
|
|
95
99
|
test:
|
96
100
|
adapter: postgresql
|
97
101
|
# ...
|
98
|
-
min_messages: WARNING
|
102
|
+
min_messages: WARNING
|
99
103
|
</pre>
|
100
104
|
|
101
105
|
## COPYRIGHT
|
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -4,17 +4,11 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
|
6
6
|
gem "rails", "~> 6.1.0"
|
7
|
+
gem "sqlite3", "~> 1.5"
|
7
8
|
|
8
9
|
group :test do
|
9
10
|
gem "simplecov", require: false
|
10
11
|
gem "codecov", require: false
|
11
12
|
end
|
12
13
|
|
13
|
-
if RUBY_VERSION >= '3.1'
|
14
|
-
gem 'net-smtp', require: false
|
15
|
-
gem 'net-imap', require: false
|
16
|
-
gem 'net-pop', require: false
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
14
|
gemspec path: "../"
|
data/gemfiles/rails_7.0.gemfile
CHANGED
data/gemfiles/rails_7.1.gemfile
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
|
6
|
-
gem "rails",
|
6
|
+
gem "rails", "~> 7.1.0"
|
7
|
+
gem "sqlite3", "~> 1.7"
|
7
8
|
|
8
9
|
group :test do
|
9
10
|
gem "simplecov", require: false
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'active_record'
|
2
1
|
require 'database_cleaner/strategy'
|
3
2
|
require 'erb'
|
4
3
|
require 'yaml'
|
@@ -15,7 +14,9 @@ module DatabaseCleaner
|
|
15
14
|
|
16
15
|
class Base < DatabaseCleaner::Strategy
|
17
16
|
def self.migration_table_name
|
18
|
-
if
|
17
|
+
if ::ActiveRecord::Base.connection_pool.respond_to?(:schema_migration) # Rails >= 7.2
|
18
|
+
::ActiveRecord::Base.connection_pool.schema_migration.table_name
|
19
|
+
elsif ::ActiveRecord::Base.connection.respond_to?(:schema_migration) # Rails >= 6.0
|
19
20
|
::ActiveRecord::Base.connection.schema_migration.table_name
|
20
21
|
else
|
21
22
|
::ActiveRecord::SchemaMigration.table_name
|
@@ -1,15 +1,12 @@
|
|
1
|
-
require 'active_record'
|
2
|
-
require 'database_cleaner/active_record/truncation'
|
3
|
-
|
4
1
|
module DatabaseCleaner
|
5
2
|
module ActiveRecord
|
6
3
|
class Deletion < Truncation
|
7
4
|
def clean
|
8
5
|
connection.disable_referential_integrity do
|
9
6
|
if pre_count? && connection.respond_to?(:pre_count_tables)
|
10
|
-
delete_tables(connection, connection.pre_count_tables(
|
7
|
+
delete_tables(connection, connection.pre_count_tables(tables_to_clean(connection)))
|
11
8
|
else
|
12
|
-
delete_tables(connection,
|
9
|
+
delete_tables(connection, tables_to_clean(connection))
|
13
10
|
end
|
14
11
|
end
|
15
12
|
end
|
@@ -19,6 +16,7 @@ module DatabaseCleaner
|
|
19
16
|
def delete_tables(connection, table_names)
|
20
17
|
table_names.each do |table_name|
|
21
18
|
delete_table(connection, table_name)
|
19
|
+
reset_id_sequence(connection, table_name) if @reset_ids
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
@@ -26,7 +24,20 @@ module DatabaseCleaner
|
|
26
24
|
connection.execute("DELETE FROM #{connection.quote_table_name(table_name)} WHERE 1=1")
|
27
25
|
end
|
28
26
|
|
29
|
-
def
|
27
|
+
def reset_id_sequence connection, table_name
|
28
|
+
case connection.adapter_name
|
29
|
+
when 'Mysql2', 'Trilogy'
|
30
|
+
connection.execute("ALTER TABLE #{table_name} AUTO_INCREMENT = 1;")
|
31
|
+
when 'SQLite'
|
32
|
+
connection.execute("delete from sqlite_sequence where name='#{table_name}';")
|
33
|
+
when 'PostgreSQL'
|
34
|
+
connection.reset_pk_sequence!(table_name)
|
35
|
+
else
|
36
|
+
raise "reset_id option not supported for #{connection.adapter_name}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def tables_to_clean(connection)
|
30
41
|
if information_schema_exists?(connection)
|
31
42
|
@except += connection.database_cleaner_view_cache + migration_storage_names
|
32
43
|
(@only.any? ? @only : tables_with_new_rows(connection)) - @except
|
@@ -64,7 +75,7 @@ module DatabaseCleaner
|
|
64
75
|
end
|
65
76
|
|
66
77
|
def information_schema_exists? connection
|
67
|
-
connection.adapter_name
|
78
|
+
["Mysql2", "Trilogy"].include?(connection.adapter_name)
|
68
79
|
end
|
69
80
|
end
|
70
81
|
end
|
@@ -1,20 +1,26 @@
|
|
1
|
-
require 'database_cleaner/active_record/base'
|
2
|
-
|
3
1
|
module DatabaseCleaner
|
4
2
|
module ActiveRecord
|
5
3
|
class Transaction < Base
|
6
4
|
def start
|
5
|
+
connection = if ::ActiveRecord.version >= Gem::Version.new("7.2")
|
6
|
+
connection_class.lease_connection
|
7
|
+
else
|
8
|
+
connection_class.connection
|
9
|
+
end
|
10
|
+
|
7
11
|
# Hack to make sure that the connection is properly set up before cleaning
|
8
|
-
|
12
|
+
connection.transaction {}
|
9
13
|
|
10
|
-
|
14
|
+
connection.begin_transaction joinable: false
|
11
15
|
end
|
12
16
|
|
13
17
|
|
14
18
|
def clean
|
15
19
|
connection_class.connection_pool.connections.each do |connection|
|
16
|
-
|
17
|
-
|
20
|
+
connection.lock.synchronize do
|
21
|
+
next unless connection.open_transactions > 0
|
22
|
+
connection.rollback_transaction
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
@@ -1,28 +1,29 @@
|
|
1
1
|
require "delegate"
|
2
|
-
require 'active_record/base'
|
3
2
|
require 'database_cleaner/active_record/base'
|
4
3
|
|
5
4
|
module DatabaseCleaner
|
6
5
|
module ActiveRecord
|
7
6
|
class Truncation < Base
|
8
7
|
def initialize(opts={})
|
9
|
-
if !opts.empty? && !(opts.keys - [:only, :except, :pre_count, :cache_tables]).empty?
|
10
|
-
raise ArgumentError, "The only valid options are :only, :except, :pre_count, and :
|
8
|
+
if !opts.empty? && !(opts.keys - [:only, :except, :pre_count, :cache_tables, :reset_ids, :truncate_option]).empty?
|
9
|
+
raise ArgumentError, "The only valid options are :only, :except, :pre_count, :reset_ids, :cache_tables and :truncate_option. You specified #{opts.keys.join(',')}."
|
11
10
|
end
|
12
11
|
|
13
12
|
@only = Array(opts[:only]).dup
|
14
13
|
@except = Array(opts[:except]).dup
|
15
14
|
|
15
|
+
@reset_ids = opts[:reset_ids]
|
16
16
|
@pre_count = opts[:pre_count]
|
17
|
+
@truncate_option = opts[:truncate_option] || :restrict
|
17
18
|
@cache_tables = opts.has_key?(:cache_tables) ? !!opts[:cache_tables] : true
|
18
19
|
end
|
19
20
|
|
20
21
|
def clean
|
21
22
|
connection.disable_referential_integrity do
|
22
23
|
if pre_count? && connection.respond_to?(:pre_count_truncate_tables)
|
23
|
-
connection.pre_count_truncate_tables(
|
24
|
+
connection.pre_count_truncate_tables(tables_to_clean(connection))
|
24
25
|
else
|
25
|
-
connection.truncate_tables(
|
26
|
+
connection.truncate_tables(tables_to_clean(connection), { truncate_option: @truncate_option })
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -30,10 +31,16 @@ module DatabaseCleaner
|
|
30
31
|
private
|
31
32
|
|
32
33
|
def connection
|
33
|
-
@connection ||= ConnectionWrapper.new(
|
34
|
+
@connection ||= ConnectionWrapper.new(
|
35
|
+
if ::ActiveRecord.version >= Gem::Version.new("7.2")
|
36
|
+
connection_class.lease_connection
|
37
|
+
else
|
38
|
+
connection_class.connection
|
39
|
+
end
|
40
|
+
)
|
34
41
|
end
|
35
42
|
|
36
|
-
def
|
43
|
+
def tables_to_clean(connection)
|
37
44
|
if @only.none?
|
38
45
|
all_tables = cache_tables? ? connection.database_cleaner_table_cache : connection.database_tables
|
39
46
|
@only = all_tables.map { |table| table.split(".").last }
|
@@ -62,7 +69,7 @@ module DatabaseCleaner
|
|
62
69
|
def initialize(connection)
|
63
70
|
extend AbstractAdapter
|
64
71
|
case connection.adapter_name
|
65
|
-
when "Mysql2"
|
72
|
+
when "Mysql2", "Trilogy"
|
66
73
|
extend AbstractMysqlAdapter
|
67
74
|
when "SQLite"
|
68
75
|
extend AbstractMysqlAdapter
|
@@ -96,7 +103,7 @@ module DatabaseCleaner
|
|
96
103
|
execute("DELETE FROM #{quote_table_name(table_name)}")
|
97
104
|
end
|
98
105
|
|
99
|
-
def truncate_tables(tables)
|
106
|
+
def truncate_tables(tables, opts)
|
100
107
|
tables.each { |t| truncate_table(t) }
|
101
108
|
end
|
102
109
|
end
|
@@ -146,7 +153,7 @@ module DatabaseCleaner
|
|
146
153
|
end
|
147
154
|
end
|
148
155
|
|
149
|
-
def truncate_tables(tables)
|
156
|
+
def truncate_tables(tables, opts)
|
150
157
|
tables.each { |t| truncate_table(t) }
|
151
158
|
end
|
152
159
|
|
@@ -187,9 +194,10 @@ module DatabaseCleaner
|
|
187
194
|
tables_with_schema
|
188
195
|
end
|
189
196
|
|
190
|
-
def truncate_tables(table_names)
|
197
|
+
def truncate_tables(table_names, opts)
|
191
198
|
return if table_names.nil? || table_names.empty?
|
192
|
-
|
199
|
+
|
200
|
+
execute("TRUNCATE TABLE #{table_names.map{|name| quote_table_name(name)}.join(', ')} RESTART IDENTITY #{opts[:truncate_option]};")
|
193
201
|
end
|
194
202
|
|
195
203
|
def pre_count_truncate_tables(tables)
|
@@ -218,7 +226,7 @@ module DatabaseCleaner
|
|
218
226
|
def has_been_used?(table)
|
219
227
|
return has_rows?(table) unless has_sequence?(table)
|
220
228
|
|
221
|
-
cur_val = select_value("SELECT
|
229
|
+
cur_val = select_value("SELECT last_value from #{table}_id_seq;").to_i
|
222
230
|
cur_val > 0
|
223
231
|
end
|
224
232
|
|
@@ -246,4 +254,3 @@ module DatabaseCleaner
|
|
246
254
|
private_constant :ConnectionWrapper
|
247
255
|
end
|
248
256
|
end
|
249
|
-
|
@@ -1,7 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_record'
|
2
2
|
require 'database_cleaner/core'
|
3
|
-
require 'database_cleaner/active_record/transaction'
|
4
|
-
require 'database_cleaner/active_record/truncation'
|
5
|
-
require 'database_cleaner/active_record/deletion'
|
6
3
|
|
7
|
-
|
4
|
+
ActiveSupport.on_load(:active_record) do
|
5
|
+
require 'database_cleaner/active_record/base'
|
6
|
+
require 'database_cleaner/active_record/transaction'
|
7
|
+
require 'database_cleaner/active_record/truncation'
|
8
|
+
require 'database_cleaner/active_record/deletion'
|
9
|
+
|
10
|
+
DatabaseCleaner[:active_record].strategy = :transaction
|
11
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_cleaner-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernesto Tagwerker
|
8
8
|
- Micah Geisel
|
9
|
-
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-05-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: database_cleaner-core
|
@@ -137,6 +136,20 @@ dependencies:
|
|
137
136
|
- - ">="
|
138
137
|
- !ruby/object:Gem::Version
|
139
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: trilogy
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
140
153
|
description: Strategies for cleaning databases using ActiveRecord. Can be used to
|
141
154
|
ensure a clean state for testing.
|
142
155
|
email:
|
@@ -148,7 +161,6 @@ files:
|
|
148
161
|
- ".github/workflows/ci.yml"
|
149
162
|
- ".gitignore"
|
150
163
|
- ".rspec"
|
151
|
-
- ".travis.yml"
|
152
164
|
- Appraisals
|
153
165
|
- CHANGELOG.md
|
154
166
|
- Gemfile
|
@@ -159,12 +171,11 @@ files:
|
|
159
171
|
- bin/setup
|
160
172
|
- database_cleaner-active_record.gemspec
|
161
173
|
- gemfiles/.bundle/config
|
162
|
-
- gemfiles/rails_5.1.gemfile
|
163
|
-
- gemfiles/rails_5.2.gemfile
|
164
|
-
- gemfiles/rails_6.0.gemfile
|
165
174
|
- gemfiles/rails_6.1.gemfile
|
166
175
|
- gemfiles/rails_7.0.gemfile
|
167
176
|
- gemfiles/rails_7.1.gemfile
|
177
|
+
- gemfiles/rails_7.2.gemfile
|
178
|
+
- gemfiles/rails_edge.gemfile
|
168
179
|
- lib/database_cleaner-active_record.rb
|
169
180
|
- lib/database_cleaner/active_record.rb
|
170
181
|
- lib/database_cleaner/active_record/base.rb
|
@@ -177,7 +188,6 @@ homepage: https://github.com/DatabaseCleaner/database_cleaner-active_record
|
|
177
188
|
licenses:
|
178
189
|
- MIT
|
179
190
|
metadata: {}
|
180
|
-
post_install_message:
|
181
191
|
rdoc_options: []
|
182
192
|
require_paths:
|
183
193
|
- lib
|
@@ -192,8 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
202
|
- !ruby/object:Gem::Version
|
193
203
|
version: '0'
|
194
204
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
-
signing_key:
|
205
|
+
rubygems_version: 3.6.2
|
197
206
|
specification_version: 4
|
198
207
|
summary: Strategies for cleaning databases using ActiveRecord. Can be used to ensure
|
199
208
|
a clean state for testing.
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
services:
|
3
|
-
- mysql
|
4
|
-
- postgresql
|
5
|
-
rvm:
|
6
|
-
- 2.5
|
7
|
-
- 2.6
|
8
|
-
- 2.7
|
9
|
-
- 3.0
|
10
|
-
gemfile:
|
11
|
-
- gemfiles/rails_5.1.gemfile
|
12
|
-
- gemfiles/rails_5.2.gemfile
|
13
|
-
- gemfiles/rails_6.0.gemfile
|
14
|
-
- gemfiles/rails_6.1.gemfile
|
15
|
-
jobs:
|
16
|
-
exclude: # Unsupported combos: https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
|
17
|
-
- rvm: 3.0
|
18
|
-
gemfile: gemfiles/rails_5.1.gemfile
|
19
|
-
- rvm: 3.0
|
20
|
-
gemfile: gemfiles/rails_5.2.gemfile
|
21
|
-
|
22
|
-
before_install:
|
23
|
-
- bin/setup
|
24
|
-
cache:
|
25
|
-
bundler: true
|
data/gemfiles/rails_6.0.gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "database_cleaner-core", git: "https://github.com/DatabaseCleaner/database_cleaner"
|
6
|
-
gem "rails", "~> 6.0.0"
|
7
|
-
|
8
|
-
group :test do
|
9
|
-
gem "simplecov", require: false
|
10
|
-
gem "codecov", require: false
|
11
|
-
end
|
12
|
-
|
13
|
-
gemspec path: "../"
|