acidic_job 1.0.0.pre14 → 1.0.0.pre15

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: fcc6621d513d4284bb09bdb4da7433b81b2c240ce9873dbf1348569e76942960
4
- data.tar.gz: 411b5819c7faab9f8bcb19f39bd4dc5c8a03d42f28239f5f19489b2f7d01eb68
3
+ metadata.gz: 027f8f80b370e238f64d6f6dbc9cbddd9738ebb97db7d5b9e35a8872933965f7
4
+ data.tar.gz: 95119d599bb5c986edce1fdcef26bf03c62b94fac85f6045d92d51b2793e59bd
5
5
  SHA512:
6
- metadata.gz: 644bc4268dfa5c66804e169314f67452b4046bdbbd4b013589b6463e0c79363407d8fbdecfc2db3197cccdb75c558059492b2a9f22a0eca0198f7033836abd05
7
- data.tar.gz: 2807478181d478a7ee10e082e7f76f42409e3c587e436712396371d92d8b53481b0606a19bbcb108fa2cb95c4529f4b9ca86b146cf1aec64c53954c57eda5971
6
+ metadata.gz: c2cbc3e2a8e6841a63e27e1622394046932e0679e7f41fe5950e25297cc6754efb5d66df0d1ed85dfb6a2089a6e52a4032e41a96ebbb0e0ec3428a2523d219b0
7
+ data.tar.gz: 42849b9a525f5e6a8d2d2c5cd4845d6cc4793331e78f9d083ebb74256227f5b0c5abc5dad01e19e4e2e17ae791ba78c7b678cfd4fb44c325f24f51203fc8f8cf
@@ -1,18 +1,41 @@
1
- name: Ruby
1
+ name: CI
2
2
 
3
- on: [push,pull_request]
3
+ on: [push]
4
4
 
5
5
  jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
+
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: ["2.7", "3.0", "3.1"]
13
+ rails: [ "6.1", "7.0" ]
14
+ services:
15
+ redis:
16
+ image: redis
17
+ options: >-
18
+ --health-cmd "redis-cli ping"
19
+ --health-interval 10s
20
+ --health-timeout 5s
21
+ --health-retries 5
22
+ ports:
23
+ - 6379:6379
24
+
25
+ env:
26
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}.gemfile
27
+
8
28
  steps:
9
- - uses: actions/checkout@v2
10
- - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
- with:
13
- ruby-version: 2.7.1
14
- - name: Run the default task
15
- run: |
16
- gem install bundler -v 2.2.31
17
- bundle install
18
- bundle exec rake
29
+ - uses: actions/checkout@v2
30
+
31
+ - name: Set up Ruby
32
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
33
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ bundler-cache: true # 'bundle install' and cache gems
37
+ ruby-version: ${{ matrix.ruby }}
38
+
39
+ - name: Run the default task
40
+ run: bundle exec rake
41
+ timeout-minutes: 2
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  /test/database.sqlite
11
11
  slides.md
12
12
  /test/dummy
13
+ /test/log
14
+ /database.sqlite
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.0.2
1
+ ruby 3.1.1
data/Gemfile CHANGED
@@ -2,35 +2,4 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in acidic_job.gemspec
6
5
  gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "minitest", "~> 5.0"
11
-
12
- gem "rubocop", "~> 1.7"
13
-
14
- gem "rubocop-minitest"
15
-
16
- gem "rubocop-rake"
17
-
18
- gem "activerecord", "~> 6.1.3.2"
19
-
20
- gem "activejob", "~> 6.1.3.2"
21
-
22
- gem "sqlite3"
23
-
24
- gem "database_cleaner"
25
-
26
- gem "simplecov"
27
-
28
- gem "pry"
29
-
30
- gem "sidekiq"
31
-
32
- gem "noticed"
33
-
34
- gem "combustion"
35
-
36
- gem "warning"
data/Gemfile.lock CHANGED
@@ -1,77 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- acidic_job (1.0.0.pre14)
5
- activerecord (>= 6.1.0)
4
+ acidic_job (1.0.0.pre15)
5
+ activerecord
6
6
  activesupport
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.3.2)
12
- actionpack (= 6.1.3.2)
13
- activesupport (= 6.1.3.2)
11
+ actioncable (7.0.2.3)
12
+ actionpack (= 7.0.2.3)
13
+ activesupport (= 7.0.2.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.3.2)
17
- actionpack (= 6.1.3.2)
18
- activejob (= 6.1.3.2)
19
- activerecord (= 6.1.3.2)
20
- activestorage (= 6.1.3.2)
21
- activesupport (= 6.1.3.2)
16
+ actionmailbox (7.0.2.3)
17
+ actionpack (= 7.0.2.3)
18
+ activejob (= 7.0.2.3)
19
+ activerecord (= 7.0.2.3)
20
+ activestorage (= 7.0.2.3)
21
+ activesupport (= 7.0.2.3)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.3.2)
24
- actionpack (= 6.1.3.2)
25
- actionview (= 6.1.3.2)
26
- activejob (= 6.1.3.2)
27
- activesupport (= 6.1.3.2)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.0.2.3)
27
+ actionpack (= 7.0.2.3)
28
+ actionview (= 7.0.2.3)
29
+ activejob (= 7.0.2.3)
30
+ activesupport (= 7.0.2.3)
28
31
  mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
29
35
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.3.2)
31
- actionview (= 6.1.3.2)
32
- activesupport (= 6.1.3.2)
33
- rack (~> 2.0, >= 2.0.9)
36
+ actionpack (7.0.2.3)
37
+ actionview (= 7.0.2.3)
38
+ activesupport (= 7.0.2.3)
39
+ rack (~> 2.0, >= 2.2.0)
34
40
  rack-test (>= 0.6.3)
35
41
  rails-dom-testing (~> 2.0)
36
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.3.2)
38
- actionpack (= 6.1.3.2)
39
- activerecord (= 6.1.3.2)
40
- activestorage (= 6.1.3.2)
41
- activesupport (= 6.1.3.2)
43
+ actiontext (7.0.2.3)
44
+ actionpack (= 7.0.2.3)
45
+ activerecord (= 7.0.2.3)
46
+ activestorage (= 7.0.2.3)
47
+ activesupport (= 7.0.2.3)
48
+ globalid (>= 0.6.0)
42
49
  nokogiri (>= 1.8.5)
43
- actionview (6.1.3.2)
44
- activesupport (= 6.1.3.2)
50
+ actionview (7.0.2.3)
51
+ activesupport (= 7.0.2.3)
45
52
  builder (~> 3.1)
46
53
  erubi (~> 1.4)
47
54
  rails-dom-testing (~> 2.0)
48
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.3.2)
50
- activesupport (= 6.1.3.2)
56
+ activejob (7.0.2.3)
57
+ activesupport (= 7.0.2.3)
51
58
  globalid (>= 0.3.6)
52
- activemodel (6.1.3.2)
53
- activesupport (= 6.1.3.2)
54
- activerecord (6.1.3.2)
55
- activemodel (= 6.1.3.2)
56
- activesupport (= 6.1.3.2)
57
- activestorage (6.1.3.2)
58
- actionpack (= 6.1.3.2)
59
- activejob (= 6.1.3.2)
60
- activerecord (= 6.1.3.2)
61
- activesupport (= 6.1.3.2)
62
- marcel (~> 1.0.0)
63
- mini_mime (~> 1.0.2)
64
- activesupport (6.1.3.2)
59
+ activemodel (7.0.2.3)
60
+ activesupport (= 7.0.2.3)
61
+ activerecord (7.0.2.3)
62
+ activemodel (= 7.0.2.3)
63
+ activesupport (= 7.0.2.3)
64
+ activestorage (7.0.2.3)
65
+ actionpack (= 7.0.2.3)
66
+ activejob (= 7.0.2.3)
67
+ activerecord (= 7.0.2.3)
68
+ activesupport (= 7.0.2.3)
69
+ marcel (~> 1.0)
70
+ mini_mime (>= 1.1.0)
71
+ activesupport (7.0.2.3)
65
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
73
  i18n (>= 1.6, < 2)
67
74
  minitest (>= 5.1)
68
75
  tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
76
  addressable (2.8.0)
71
77
  public_suffix (>= 2.0.2, < 5.0)
72
78
  ast (2.4.2)
73
79
  builder (3.2.4)
74
- coderay (1.1.3)
75
80
  combustion (1.3.5)
76
81
  activesupport (>= 3.0.0)
77
82
  railties (>= 3.0.0)
@@ -85,6 +90,7 @@ GEM
85
90
  activerecord (>= 5.a)
86
91
  database_cleaner-core (~> 2.0.0)
87
92
  database_cleaner-core (2.0.1)
93
+ digest (3.1.0)
88
94
  docile (1.4.0)
89
95
  domain_name (0.5.20190701)
90
96
  unf (>= 0.0.5, < 1.0.0)
@@ -93,8 +99,8 @@ GEM
93
99
  ffi-compiler (1.0.1)
94
100
  ffi (>= 1.0.0)
95
101
  rake
96
- globalid (0.4.2)
97
- activesupport (>= 4.2.0)
102
+ globalid (1.0.0)
103
+ activesupport (>= 5.0)
98
104
  http (5.0.4)
99
105
  addressable (~> 2.8)
100
106
  http-cookie (~> 1.0)
@@ -103,89 +109,102 @@ GEM
103
109
  http-cookie (1.0.4)
104
110
  domain_name (~> 0.5)
105
111
  http-form_data (2.3.0)
106
- i18n (1.8.10)
112
+ i18n (1.10.0)
107
113
  concurrent-ruby (~> 1.0)
114
+ io-wait (0.2.1)
108
115
  llhttp-ffi (0.4.0)
109
116
  ffi-compiler (~> 1.0)
110
117
  rake (~> 13.0)
111
- loofah (2.12.0)
118
+ loofah (2.15.0)
112
119
  crass (~> 1.0.2)
113
120
  nokogiri (>= 1.5.9)
114
121
  mail (2.7.1)
115
122
  mini_mime (>= 0.1.1)
116
123
  marcel (1.0.2)
117
124
  method_source (1.0.0)
118
- mini_mime (1.0.3)
119
- mini_portile2 (2.6.1)
120
- minitest (5.14.4)
125
+ mini_mime (1.1.2)
126
+ mini_portile2 (2.8.0)
127
+ minitest (5.15.0)
128
+ net-imap (0.2.3)
129
+ digest
130
+ net-protocol
131
+ strscan
132
+ net-pop (0.1.1)
133
+ digest
134
+ net-protocol
135
+ timeout
136
+ net-protocol (0.1.2)
137
+ io-wait
138
+ timeout
139
+ net-smtp (0.3.1)
140
+ digest
141
+ net-protocol
142
+ timeout
121
143
  nio4r (2.5.8)
122
- nokogiri (1.12.3)
123
- mini_portile2 (~> 2.6.1)
144
+ nokogiri (1.13.3)
145
+ mini_portile2 (~> 2.8.0)
124
146
  racc (~> 1.4)
125
- nokogiri (1.12.3-x86_64-darwin)
147
+ nokogiri (1.13.3-x86_64-darwin)
126
148
  racc (~> 1.4)
127
- noticed (1.5.7)
149
+ noticed (1.5.9)
128
150
  http (>= 4.0.0)
129
151
  rails (>= 5.2.0)
130
- parallel (1.20.1)
131
- parser (3.0.1.1)
152
+ parallel (1.21.0)
153
+ parser (3.1.1.0)
132
154
  ast (~> 2.4.1)
133
- pry (0.14.1)
134
- coderay (~> 1.1)
135
- method_source (~> 1.0)
136
155
  public_suffix (4.0.6)
137
- racc (1.5.2)
156
+ racc (1.6.0)
138
157
  rack (2.2.3)
139
158
  rack-test (1.1.0)
140
159
  rack (>= 1.0, < 3)
141
- rails (6.1.3.2)
142
- actioncable (= 6.1.3.2)
143
- actionmailbox (= 6.1.3.2)
144
- actionmailer (= 6.1.3.2)
145
- actionpack (= 6.1.3.2)
146
- actiontext (= 6.1.3.2)
147
- actionview (= 6.1.3.2)
148
- activejob (= 6.1.3.2)
149
- activemodel (= 6.1.3.2)
150
- activerecord (= 6.1.3.2)
151
- activestorage (= 6.1.3.2)
152
- activesupport (= 6.1.3.2)
160
+ rails (7.0.2.3)
161
+ actioncable (= 7.0.2.3)
162
+ actionmailbox (= 7.0.2.3)
163
+ actionmailer (= 7.0.2.3)
164
+ actionpack (= 7.0.2.3)
165
+ actiontext (= 7.0.2.3)
166
+ actionview (= 7.0.2.3)
167
+ activejob (= 7.0.2.3)
168
+ activemodel (= 7.0.2.3)
169
+ activerecord (= 7.0.2.3)
170
+ activestorage (= 7.0.2.3)
171
+ activesupport (= 7.0.2.3)
153
172
  bundler (>= 1.15.0)
154
- railties (= 6.1.3.2)
155
- sprockets-rails (>= 2.0.0)
173
+ railties (= 7.0.2.3)
156
174
  rails-dom-testing (2.0.3)
157
175
  activesupport (>= 4.2.0)
158
176
  nokogiri (>= 1.6)
159
- rails-html-sanitizer (1.4.1)
177
+ rails-html-sanitizer (1.4.2)
160
178
  loofah (~> 2.3)
161
- railties (6.1.3.2)
162
- actionpack (= 6.1.3.2)
163
- activesupport (= 6.1.3.2)
179
+ railties (7.0.2.3)
180
+ actionpack (= 7.0.2.3)
181
+ activesupport (= 7.0.2.3)
164
182
  method_source
165
- rake (>= 0.8.7)
183
+ rake (>= 12.2)
166
184
  thor (~> 1.0)
167
- rainbow (3.0.0)
168
- rake (13.0.4)
169
- redis (4.4.0)
170
- regexp_parser (2.1.1)
185
+ zeitwerk (~> 2.5)
186
+ rainbow (3.1.1)
187
+ rake (13.0.6)
188
+ redis (4.6.0)
189
+ regexp_parser (2.2.1)
171
190
  rexml (3.2.5)
172
- rubocop (1.18.3)
191
+ rubocop (1.26.0)
173
192
  parallel (~> 1.10)
174
- parser (>= 3.0.0.0)
193
+ parser (>= 3.1.0.0)
175
194
  rainbow (>= 2.2.2, < 4.0)
176
195
  regexp_parser (>= 1.8, < 3.0)
177
196
  rexml
178
- rubocop-ast (>= 1.7.0, < 2.0)
197
+ rubocop-ast (>= 1.16.0, < 2.0)
179
198
  ruby-progressbar (~> 1.7)
180
199
  unicode-display_width (>= 1.4.0, < 3.0)
181
- rubocop-ast (1.7.0)
182
- parser (>= 3.0.1.1)
183
- rubocop-minitest (0.14.0)
200
+ rubocop-ast (1.16.0)
201
+ parser (>= 3.1.1.0)
202
+ rubocop-minitest (0.18.0)
184
203
  rubocop (>= 0.90, < 2.0)
185
204
  rubocop-rake (0.6.0)
186
205
  rubocop (~> 1.0)
187
206
  ruby-progressbar (1.11.0)
188
- sidekiq (6.2.2)
207
+ sidekiq (6.4.1)
189
208
  connection_pool (>= 2.2.2)
190
209
  rack (~> 2.0)
191
210
  redis (>= 4.2.0)
@@ -194,27 +213,22 @@ GEM
194
213
  simplecov-html (~> 0.11)
195
214
  simplecov_json_formatter (~> 0.1)
196
215
  simplecov-html (0.12.3)
197
- simplecov_json_formatter (0.1.3)
198
- sprockets (4.0.3)
199
- concurrent-ruby (~> 1.0)
200
- rack (> 1, < 3)
201
- sprockets-rails (3.4.2)
202
- actionpack (>= 5.2)
203
- activesupport (>= 5.2)
204
- sprockets (>= 3.0.0)
216
+ simplecov_json_formatter (0.1.4)
205
217
  sqlite3 (1.4.2)
206
- thor (1.1.0)
218
+ strscan (3.0.1)
219
+ thor (1.2.1)
220
+ timeout (0.2.0)
207
221
  tzinfo (2.0.4)
208
222
  concurrent-ruby (~> 1.0)
209
223
  unf (0.1.4)
210
224
  unf_ext
211
- unf_ext (0.0.8)
212
- unicode-display_width (2.0.0)
225
+ unf_ext (0.0.8.1)
226
+ unicode-display_width (2.1.0)
213
227
  warning (1.2.1)
214
228
  websocket-driver (0.7.5)
215
229
  websocket-extensions (>= 0.1.0)
216
230
  websocket-extensions (0.1.5)
217
- zeitwerk (2.4.2)
231
+ zeitwerk (2.5.4)
218
232
 
219
233
  PLATFORMS
220
234
  ruby
@@ -222,16 +236,15 @@ PLATFORMS
222
236
 
223
237
  DEPENDENCIES
224
238
  acidic_job!
225
- activejob (~> 6.1.3.2)
226
- activerecord (~> 6.1.3.2)
239
+ activejob
227
240
  combustion
228
241
  database_cleaner
229
- minitest (~> 5.0)
242
+ minitest
243
+ net-smtp
230
244
  noticed
231
- pry
232
- railties (>= 6.1.0)
233
- rake (~> 13.0)
234
- rubocop (~> 1.7)
245
+ railties
246
+ rake
247
+ rubocop
235
248
  rubocop-minitest
236
249
  rubocop-rake
237
250
  sidekiq
@@ -240,4 +253,4 @@ DEPENDENCIES
240
253
  warning
241
254
 
242
255
  BUNDLED WITH
243
- 2.2.31
256
+ 2.2.32
data/acidic_job.gemspec CHANGED
@@ -27,10 +27,25 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_dependency "activerecord", ">= 6.1.0"
30
+ spec.add_dependency "activerecord"
31
31
  spec.add_dependency "activesupport"
32
- spec.add_development_dependency "railties", ">= 6.1.0"
32
+ spec.add_development_dependency "activejob"
33
+ spec.add_development_dependency "combustion"
34
+ spec.add_development_dependency "database_cleaner"
35
+ spec.add_development_dependency "minitest"
36
+ spec.add_development_dependency "net-smtp"
37
+ spec.add_development_dependency "noticed"
38
+ spec.add_development_dependency "railties"
39
+ spec.add_development_dependency "rake"
40
+ spec.add_development_dependency "rubocop"
41
+ spec.add_development_dependency "rubocop-minitest"
42
+ spec.add_development_dependency "rubocop-rake"
43
+ spec.add_development_dependency "sidekiq"
44
+ spec.add_development_dependency "simplecov"
45
+ spec.add_development_dependency "sqlite3"
46
+ spec.add_development_dependency "warning"
33
47
 
34
48
  # For more information and examples about making a new gem, checkout our
35
49
  # guide at: https://bundler.io/guides/creating_gem.html
50
+ spec.metadata["rubygems_mfa_required"] = "true"
36
51
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 6.1.0"
6
+ gem "railties", "~> 6.1.0"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activemodel", "~> 7.0.0"
6
+ gem "railties", "~> 7.0.0"
7
+
8
+ gemspec path: "../"
@@ -1,71 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_job/test_case"
4
- require "database_cleaner"
3
+ require_relative "./testing"
5
4
 
6
5
  module AcidicJob
7
6
  class TestCase < ActiveJob::TestCase
8
- self.use_transactional_tests = false if respond_to?(:use_transactional_tests)
9
-
10
- def before_setup
11
- @original_cleaners = DatabaseCleaner.cleaners
12
- DatabaseCleaner.cleaners = transaction_free_cleaners_for(@original_cleaners)
13
- super
14
- DatabaseCleaner.start
15
- end
16
-
17
- def after_teardown
18
- DatabaseCleaner.clean
19
- super
20
- DatabaseCleaner.cleaners = @original_cleaners
21
- end
22
-
23
- private
24
-
25
- # Ensure that the system's original DatabaseCleaner configuration is maintained, options included,
26
- # except that any `transaction` strategies for any ORMs are replaced with a `deletion` strategy.
27
- def transaction_free_cleaners_for(original_cleaners)
28
- non_transaction_cleaners = original_cleaners.dup.map do |(orm, opts), cleaner|
29
- [[orm, opts], ensure_no_transaction_strategies_for(cleaner)]
30
- end.to_h
31
- DatabaseCleaner::Cleaners.new(non_transaction_cleaners)
32
- end
33
-
34
- def ensure_no_transaction_strategies_for(cleaner)
35
- return cleaner unless strategy_name_for(cleaner) == "transaction"
36
-
37
- cleaner.strategy = deletion_strategy_for(cleaner)
38
- cleaner
39
- end
40
-
41
- def strategy_name_for(cleaner)
42
- cleaner # <DatabaseCleaner::Cleaner>
43
- .strategy # <DatabaseCleaner::ActiveRecord::Truncation>
44
- .class # DatabaseCleaner::ActiveRecord::Truncation
45
- .name # "DatabaseCleaner::ActiveRecord::Truncation"
46
- .rpartition("::") # ["DatabaseCleaner::ActiveRecord", "::", "Truncation"]
47
- .last # "Truncation"
48
- .downcase # "truncation"
49
- end
50
-
51
- def deletion_strategy_for(cleaner)
52
- strategy = cleaner.strategy
53
- strategy_namespace = strategy # <DatabaseCleaner::ActiveRecord::Truncation>
54
- .class # DatabaseCleaner::ActiveRecord::Truncation
55
- .name # "DatabaseCleaner::ActiveRecord::Truncation"
56
- .rpartition("::") # ["DatabaseCleaner::ActiveRecord", "::", "Truncation"]
57
- .first # "DatabaseCleaner::ActiveRecord"
58
- deletion_strategy_class_name = [strategy_namespace, "::", "Deletion"].join
59
- deletion_strategy_class = deletion_strategy_class_name.constantize
60
- instance_variable_hash = strategy.instance_variables.map do |var|
61
- [
62
- var.to_s.remove("@"),
63
- strategy.instance_variable_get(var)
64
- ]
65
- end.to_h
66
- options = instance_variable_hash.except("db", "connection_class")
67
-
68
- deletion_strategy_class.new(**options)
69
- end
7
+ include AcidicJob::Testing
70
8
  end
71
9
  end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_job/queue_adapters"
4
+ require "active_job/base"
5
+ require "active_job/test_helper"
6
+ require "active_job/test_case"
7
+ require "database_cleaner"
8
+
9
+ module AcidicJob
10
+ module Testing
11
+ def self.included(mod)
12
+ mod.class_eval "self.use_transactional_tests = false if respond_to?(:use_transactional_tests)", __FILE__, __LINE__
13
+ end
14
+
15
+ def before_setup
16
+ @connection = ActiveRecord::Base.connection
17
+ @original_cleaners = DatabaseCleaner.cleaners
18
+ DatabaseCleaner.cleaners = transaction_free_cleaners_for(@original_cleaners)
19
+ super
20
+ DatabaseCleaner.start
21
+ end
22
+
23
+ def after_teardown
24
+ DatabaseCleaner.clean
25
+ super
26
+ DatabaseCleaner.cleaners = @original_cleaners
27
+ end
28
+
29
+ private
30
+
31
+ # Ensure that the system's original DatabaseCleaner configuration is maintained, options included,
32
+ # except that any `transaction` strategies for any ORMs are replaced with a `deletion` strategy.
33
+ def transaction_free_cleaners_for(original_cleaners)
34
+ non_transaction_cleaners = original_cleaners.dup.to_h do |(orm, opts), cleaner|
35
+ [[orm, opts], ensure_no_transaction_strategies_for(cleaner)]
36
+ end
37
+ DatabaseCleaner::Cleaners.new(non_transaction_cleaners)
38
+ end
39
+
40
+ def ensure_no_transaction_strategies_for(cleaner)
41
+ return cleaner unless strategy_name_for(cleaner) == "transaction"
42
+
43
+ cleaner.strategy = deletion_strategy_for(cleaner)
44
+ cleaner
45
+ end
46
+
47
+ def strategy_name_for(cleaner)
48
+ cleaner # <DatabaseCleaner::Cleaner>
49
+ .strategy # <DatabaseCleaner::ActiveRecord::Truncation>
50
+ .class # DatabaseCleaner::ActiveRecord::Truncation
51
+ .name # "DatabaseCleaner::ActiveRecord::Truncation"
52
+ .rpartition("::") # ["DatabaseCleaner::ActiveRecord", "::", "Truncation"]
53
+ .last # "Truncation"
54
+ .downcase # "truncation"
55
+ end
56
+
57
+ def deletion_strategy_for(cleaner)
58
+ strategy = cleaner.strategy
59
+ strategy_namespace = strategy # <DatabaseCleaner::ActiveRecord::Truncation>
60
+ .class # DatabaseCleaner::ActiveRecord::Truncation
61
+ .name # "DatabaseCleaner::ActiveRecord::Truncation"
62
+ .rpartition("::") # ["DatabaseCleaner::ActiveRecord", "::", "Truncation"]
63
+ .first # "DatabaseCleaner::ActiveRecord"
64
+ deletion_strategy_class_name = [strategy_namespace, "::", "Deletion"].join
65
+ deletion_strategy_class = deletion_strategy_class_name.constantize
66
+ instance_variable_hash = strategy.instance_variables.to_h do |var|
67
+ [
68
+ var.to_s.remove("@"),
69
+ strategy.instance_variable_get(var)
70
+ ]
71
+ end
72
+ options = instance_variable_hash.except("db", "connection_class")
73
+
74
+ deletion_strategy_class.new(**options)
75
+ end
76
+ end
77
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AcidicJob
4
- VERSION = "1.0.0.pre14"
4
+ VERSION = "1.0.0.pre15"
5
5
  end
data/lib/acidic_job.rb CHANGED
@@ -17,6 +17,8 @@ require_relative "acidic_job/extensions/noticed"
17
17
  require_relative "acidic_job/upgrade_service"
18
18
 
19
19
  require "active_support/concern"
20
+ require "active_job/queue_adapters"
21
+ require "active_job/base"
20
22
 
21
23
  module AcidicJob
22
24
  extend ActiveSupport::Concern
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acidic_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre14
4
+ version: 1.0.0.pre15
5
5
  platform: ruby
6
6
  authors:
7
7
  - fractaledmind
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-18 00:00:00.000000000 Z
11
+ date: 2022-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.1.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 6.1.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,20 +38,216 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activejob
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: combustion
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: database_cleaner
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: net-smtp
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: noticed
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
41
125
  - !ruby/object:Gem::Dependency
42
126
  name: railties
43
127
  requirement: !ruby/object:Gem::Requirement
44
128
  requirements:
45
129
  - - ">="
46
130
  - !ruby/object:Gem::Version
47
- version: 6.1.0
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rake
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'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
48
160
  type: :development
49
161
  prerelease: false
50
162
  version_requirements: !ruby/object:Gem::Requirement
51
163
  requirements:
52
164
  - - ">="
53
165
  - !ruby/object:Gem::Version
54
- version: 6.1.0
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-minitest
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop-rake
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: sidekiq
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: simplecov
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: sqlite3
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: warning
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
55
251
  description: Idempotent operations for Rails apps, built on top of ActiveJob.
56
252
  email:
57
253
  - stephen.margheim@gmail.com
@@ -74,6 +270,8 @@ files:
74
270
  - bin/console
75
271
  - bin/setup
76
272
  - blog_post.md
273
+ - gemfiles/rails_6.1.gemfile
274
+ - gemfiles/rails_7.0.gemfile
77
275
  - lib/acidic_job.rb
78
276
  - lib/acidic_job/awaiting.rb
79
277
  - lib/acidic_job/errors.rb
@@ -90,6 +288,7 @@ files:
90
288
  - lib/acidic_job/staging.rb
91
289
  - lib/acidic_job/step.rb
92
290
  - lib/acidic_job/test_case.rb
291
+ - lib/acidic_job/testing.rb
93
292
  - lib/acidic_job/upgrade_service.rb
94
293
  - lib/acidic_job/version.rb
95
294
  - lib/generators/acidic_job/drop_tables_generator.rb
@@ -103,6 +302,7 @@ metadata:
103
302
  homepage_uri: https://github.com/fractaledmind/acidic_job
104
303
  source_code_uri: https://github.com/fractaledmind/acidic_job
105
304
  changelog_uri: https://github.com/fractaledmind/acidic_job/CHANGELOG.md
305
+ rubygems_mfa_required: 'true'
106
306
  post_install_message:
107
307
  rdoc_options: []
108
308
  require_paths:
@@ -118,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
318
  - !ruby/object:Gem::Version
119
319
  version: 1.3.1
120
320
  requirements: []
121
- rubygems_version: 3.2.22
321
+ rubygems_version: 3.3.7
122
322
  signing_key:
123
323
  specification_version: 4
124
324
  summary: Idempotent operations for Rails apps, built on top of ActiveJob.