active_job_log 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +153 -133
- data/README.md +14 -0
- data/lib/active_job_log/log_ext.rb +38 -19
- data/lib/active_job_log/version.rb +1 -1
- data/spec/lib/active_job_log/log_ext_spec.rb +50 -17
- data/spec/rails_helper.rb +1 -0
- metadata +4 -6
- data/spec/dummy/config/initializers/assets.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d995c15d7ce558b13df9aa8a93dc16803aa293c71115cde705346525fd18e978
|
4
|
+
data.tar.gz: '039703a5a0698f5615efd2a1b811f1797d2c5d5116ec5b6c408d66841dae7cc1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7440e25d80a54090b6fbe25ed1e21e8d23a7289c10db25245cf9563bbad453ee494b8b1672cb43691d61efeb4e62eda001129da800fbc1d2602d69d06722aa9
|
7
|
+
data.tar.gz: 45e191cb100b18e33f0ba12c0c0f2ab3490fd1163fb0eb7bb61099565fbea5df0fe9773b76af983819fc6ce2fe0cfbe0a0c4836943d3e5caa1a653e1f1f03b56
|
data/.circleci/config.yml
CHANGED
@@ -14,10 +14,10 @@ executors:
|
|
14
14
|
parameters:
|
15
15
|
ruby-version:
|
16
16
|
description: "Ruby version"
|
17
|
-
default: "2
|
17
|
+
default: "3.2"
|
18
18
|
type: string
|
19
19
|
docker:
|
20
|
-
- image:
|
20
|
+
- image: cimg/ruby:<<parameters.ruby-version>>-node
|
21
21
|
environment: *env-vars
|
22
22
|
|
23
23
|
commands:
|
@@ -94,7 +94,7 @@ workflows:
|
|
94
94
|
- test:
|
95
95
|
matrix:
|
96
96
|
parameters:
|
97
|
-
ruby-version: ["2.
|
97
|
+
ruby-version: [ "2.7", "3.1", "3.2"]
|
98
98
|
- deploy:
|
99
99
|
context: org-global
|
100
100
|
filters:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2
|
1
|
+
3.2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
### v3.0.0
|
6
|
+
|
7
|
+
#### Changed
|
8
|
+
|
9
|
+
* Add Ruby 3.2 support
|
10
|
+
* Remove Ruby 2.5 and 2.6 support
|
11
|
+
|
12
|
+
### v2.1.0
|
13
|
+
|
14
|
+
#### Added
|
15
|
+
|
16
|
+
* Avoid logging using `disable_job_logs` class method.
|
17
|
+
|
5
18
|
### v2.0.0
|
6
19
|
|
7
20
|
#### Changed
|
data/Gemfile.lock
CHANGED
@@ -1,76 +1,82 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_job_log (
|
4
|
+
active_job_log (3.0.0)
|
5
5
|
enumerize (>= 1.0)
|
6
6
|
rails (>= 6.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (
|
12
|
-
actionpack (=
|
13
|
-
activesupport (=
|
11
|
+
actioncable (7.0.6)
|
12
|
+
actionpack (= 7.0.6)
|
13
|
+
activesupport (= 7.0.6)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (
|
17
|
-
actionpack (=
|
18
|
-
activejob (=
|
19
|
-
activerecord (=
|
20
|
-
activestorage (=
|
21
|
-
activesupport (=
|
16
|
+
actionmailbox (7.0.6)
|
17
|
+
actionpack (= 7.0.6)
|
18
|
+
activejob (= 7.0.6)
|
19
|
+
activerecord (= 7.0.6)
|
20
|
+
activestorage (= 7.0.6)
|
21
|
+
activesupport (= 7.0.6)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.0.6)
|
27
|
+
actionpack (= 7.0.6)
|
28
|
+
actionview (= 7.0.6)
|
29
|
+
activejob (= 7.0.6)
|
30
|
+
activesupport (= 7.0.6)
|
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 (
|
31
|
-
actionview (=
|
32
|
-
activesupport (=
|
33
|
-
rack (~> 2.0, >= 2.
|
36
|
+
actionpack (7.0.6)
|
37
|
+
actionview (= 7.0.6)
|
38
|
+
activesupport (= 7.0.6)
|
39
|
+
rack (~> 2.0, >= 2.2.4)
|
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 (
|
38
|
-
actionpack (=
|
39
|
-
activerecord (=
|
40
|
-
activestorage (=
|
41
|
-
activesupport (=
|
43
|
+
actiontext (7.0.6)
|
44
|
+
actionpack (= 7.0.6)
|
45
|
+
activerecord (= 7.0.6)
|
46
|
+
activestorage (= 7.0.6)
|
47
|
+
activesupport (= 7.0.6)
|
48
|
+
globalid (>= 0.6.0)
|
42
49
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (
|
44
|
-
activesupport (=
|
50
|
+
actionview (7.0.6)
|
51
|
+
activesupport (= 7.0.6)
|
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 (
|
50
|
-
activesupport (=
|
56
|
+
activejob (7.0.6)
|
57
|
+
activesupport (= 7.0.6)
|
51
58
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (
|
53
|
-
activesupport (=
|
54
|
-
activerecord (
|
55
|
-
activemodel (=
|
56
|
-
activesupport (=
|
57
|
-
activestorage (
|
58
|
-
actionpack (=
|
59
|
-
activejob (=
|
60
|
-
activerecord (=
|
61
|
-
activesupport (=
|
62
|
-
marcel (~> 1.0
|
63
|
-
mini_mime (
|
64
|
-
activesupport (
|
59
|
+
activemodel (7.0.6)
|
60
|
+
activesupport (= 7.0.6)
|
61
|
+
activerecord (7.0.6)
|
62
|
+
activemodel (= 7.0.6)
|
63
|
+
activesupport (= 7.0.6)
|
64
|
+
activestorage (7.0.6)
|
65
|
+
actionpack (= 7.0.6)
|
66
|
+
activejob (= 7.0.6)
|
67
|
+
activerecord (= 7.0.6)
|
68
|
+
activesupport (= 7.0.6)
|
69
|
+
marcel (~> 1.0)
|
70
|
+
mini_mime (>= 1.1.0)
|
71
|
+
activesupport (7.0.6)
|
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
|
ast (2.4.2)
|
71
77
|
builder (3.2.4)
|
72
78
|
coderay (1.1.3)
|
73
|
-
concurrent-ruby (1.
|
79
|
+
concurrent-ruby (1.2.2)
|
74
80
|
coveralls (0.8.23)
|
75
81
|
json (>= 1.8, < 3)
|
76
82
|
simplecov (~> 0.16.1)
|
@@ -78,141 +84,155 @@ GEM
|
|
78
84
|
thor (>= 0.19.4, < 2.0)
|
79
85
|
tins (~> 1.6)
|
80
86
|
crass (1.0.6)
|
81
|
-
|
87
|
+
date (3.3.3)
|
88
|
+
diff-lcs (1.5.0)
|
82
89
|
docile (1.4.0)
|
83
|
-
enumerize (2.
|
90
|
+
enumerize (2.6.1)
|
84
91
|
activesupport (>= 3.2)
|
85
|
-
erubi (1.
|
86
|
-
factory_bot (6.2.
|
92
|
+
erubi (1.12.0)
|
93
|
+
factory_bot (6.2.1)
|
87
94
|
activesupport (>= 5.0.0)
|
88
95
|
factory_bot_rails (6.2.0)
|
89
96
|
factory_bot (~> 6.2.0)
|
90
97
|
railties (>= 5.0.0)
|
91
|
-
globalid (
|
92
|
-
activesupport (>=
|
93
|
-
i18n (1.
|
98
|
+
globalid (1.1.0)
|
99
|
+
activesupport (>= 5.0)
|
100
|
+
i18n (1.14.1)
|
94
101
|
concurrent-ruby (~> 1.0)
|
95
|
-
json (2.
|
96
|
-
|
102
|
+
json (2.6.3)
|
103
|
+
language_server-protocol (3.17.0.3)
|
104
|
+
loofah (2.21.3)
|
97
105
|
crass (~> 1.0.2)
|
98
|
-
nokogiri (>= 1.
|
99
|
-
mail (2.
|
106
|
+
nokogiri (>= 1.12.0)
|
107
|
+
mail (2.8.1)
|
100
108
|
mini_mime (>= 0.1.1)
|
101
|
-
|
109
|
+
net-imap
|
110
|
+
net-pop
|
111
|
+
net-smtp
|
112
|
+
marcel (1.0.2)
|
102
113
|
method_source (1.0.0)
|
103
|
-
mini_mime (1.
|
104
|
-
minitest (5.
|
105
|
-
|
106
|
-
|
114
|
+
mini_mime (1.1.2)
|
115
|
+
minitest (5.18.1)
|
116
|
+
net-imap (0.3.6)
|
117
|
+
date
|
118
|
+
net-protocol
|
119
|
+
net-pop (0.1.2)
|
120
|
+
net-protocol
|
121
|
+
net-protocol (0.2.1)
|
122
|
+
timeout
|
123
|
+
net-smtp (0.3.3)
|
124
|
+
net-protocol
|
125
|
+
nio4r (2.5.9)
|
126
|
+
nokogiri (1.15.2-arm64-darwin)
|
107
127
|
racc (~> 1.4)
|
108
|
-
nokogiri (1.
|
128
|
+
nokogiri (1.15.2-x86_64-linux)
|
109
129
|
racc (~> 1.4)
|
110
|
-
parallel (1.
|
111
|
-
parser (3.
|
130
|
+
parallel (1.23.0)
|
131
|
+
parser (3.2.2.3)
|
112
132
|
ast (~> 2.4.1)
|
113
|
-
|
133
|
+
racc
|
134
|
+
pry (0.14.2)
|
114
135
|
coderay (~> 1.1)
|
115
136
|
method_source (~> 1.0)
|
116
137
|
pry-rails (0.3.9)
|
117
138
|
pry (>= 0.10.4)
|
118
|
-
racc (1.
|
119
|
-
rack (2.2.
|
120
|
-
rack-test (
|
121
|
-
rack (>= 1.
|
122
|
-
rails (
|
123
|
-
actioncable (=
|
124
|
-
actionmailbox (=
|
125
|
-
actionmailer (=
|
126
|
-
actionpack (=
|
127
|
-
actiontext (=
|
128
|
-
actionview (=
|
129
|
-
activejob (=
|
130
|
-
activemodel (=
|
131
|
-
activerecord (=
|
132
|
-
activestorage (=
|
133
|
-
activesupport (=
|
139
|
+
racc (1.7.1)
|
140
|
+
rack (2.2.7)
|
141
|
+
rack-test (2.1.0)
|
142
|
+
rack (>= 1.3)
|
143
|
+
rails (7.0.6)
|
144
|
+
actioncable (= 7.0.6)
|
145
|
+
actionmailbox (= 7.0.6)
|
146
|
+
actionmailer (= 7.0.6)
|
147
|
+
actionpack (= 7.0.6)
|
148
|
+
actiontext (= 7.0.6)
|
149
|
+
actionview (= 7.0.6)
|
150
|
+
activejob (= 7.0.6)
|
151
|
+
activemodel (= 7.0.6)
|
152
|
+
activerecord (= 7.0.6)
|
153
|
+
activestorage (= 7.0.6)
|
154
|
+
activesupport (= 7.0.6)
|
134
155
|
bundler (>= 1.15.0)
|
135
|
-
railties (=
|
136
|
-
|
137
|
-
|
138
|
-
|
156
|
+
railties (= 7.0.6)
|
157
|
+
rails-dom-testing (2.1.1)
|
158
|
+
activesupport (>= 5.0.0)
|
159
|
+
minitest
|
139
160
|
nokogiri (>= 1.6)
|
140
|
-
rails-html-sanitizer (1.
|
141
|
-
loofah (~> 2.
|
142
|
-
|
143
|
-
|
144
|
-
|
161
|
+
rails-html-sanitizer (1.6.0)
|
162
|
+
loofah (~> 2.21)
|
163
|
+
nokogiri (~> 1.14)
|
164
|
+
railties (7.0.6)
|
165
|
+
actionpack (= 7.0.6)
|
166
|
+
activesupport (= 7.0.6)
|
145
167
|
method_source
|
146
|
-
rake (>=
|
168
|
+
rake (>= 12.2)
|
147
169
|
thor (~> 1.0)
|
148
|
-
|
149
|
-
|
150
|
-
|
170
|
+
zeitwerk (~> 2.5)
|
171
|
+
rainbow (3.1.1)
|
172
|
+
rake (13.0.6)
|
173
|
+
regexp_parser (2.8.1)
|
151
174
|
rexml (3.2.5)
|
152
|
-
rspec-core (3.
|
153
|
-
rspec-support (~> 3.
|
154
|
-
rspec-expectations (3.
|
175
|
+
rspec-core (3.12.2)
|
176
|
+
rspec-support (~> 3.12.0)
|
177
|
+
rspec-expectations (3.12.3)
|
155
178
|
diff-lcs (>= 1.2.0, < 2.0)
|
156
|
-
rspec-support (~> 3.
|
157
|
-
rspec-mocks (3.
|
179
|
+
rspec-support (~> 3.12.0)
|
180
|
+
rspec-mocks (3.12.5)
|
158
181
|
diff-lcs (>= 1.2.0, < 2.0)
|
159
|
-
rspec-support (~> 3.
|
160
|
-
rspec-rails (
|
161
|
-
actionpack (>=
|
162
|
-
activesupport (>=
|
163
|
-
railties (>=
|
164
|
-
rspec-core (~> 3.
|
165
|
-
rspec-expectations (~> 3.
|
166
|
-
rspec-mocks (~> 3.
|
167
|
-
rspec-support (~> 3.
|
168
|
-
rspec-support (3.
|
169
|
-
rspec_junit_formatter (0.
|
182
|
+
rspec-support (~> 3.12.0)
|
183
|
+
rspec-rails (6.0.3)
|
184
|
+
actionpack (>= 6.1)
|
185
|
+
activesupport (>= 6.1)
|
186
|
+
railties (>= 6.1)
|
187
|
+
rspec-core (~> 3.12)
|
188
|
+
rspec-expectations (~> 3.12)
|
189
|
+
rspec-mocks (~> 3.12)
|
190
|
+
rspec-support (~> 3.12)
|
191
|
+
rspec-support (3.12.1)
|
192
|
+
rspec_junit_formatter (0.6.0)
|
170
193
|
rspec-core (>= 2, < 4, != 2.12.0)
|
171
|
-
rubocop (1.
|
194
|
+
rubocop (1.54.0)
|
195
|
+
json (~> 2.3)
|
196
|
+
language_server-protocol (>= 3.17.0)
|
172
197
|
parallel (~> 1.10)
|
173
|
-
parser (>= 3.
|
198
|
+
parser (>= 3.2.2.3)
|
174
199
|
rainbow (>= 2.2.2, < 4.0)
|
175
200
|
regexp_parser (>= 1.8, < 3.0)
|
176
|
-
rexml
|
177
|
-
rubocop-ast (>= 1.
|
201
|
+
rexml (>= 3.2.5, < 4.0)
|
202
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
178
203
|
ruby-progressbar (~> 1.7)
|
179
|
-
unicode-display_width (>=
|
180
|
-
rubocop-ast (1.
|
181
|
-
parser (>= 3.
|
182
|
-
rubocop-rails (2.
|
204
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
205
|
+
rubocop-ast (1.29.0)
|
206
|
+
parser (>= 3.2.1.0)
|
207
|
+
rubocop-rails (2.20.2)
|
183
208
|
activesupport (>= 4.2.0)
|
184
209
|
rack (>= 1.1)
|
185
|
-
rubocop (>= 1.
|
186
|
-
ruby-progressbar (1.
|
210
|
+
rubocop (>= 1.33.0, < 2.0)
|
211
|
+
ruby-progressbar (1.13.0)
|
187
212
|
simplecov (0.16.1)
|
188
213
|
docile (~> 1.1)
|
189
214
|
json (>= 1.8, < 3)
|
190
215
|
simplecov-html (~> 0.10.0)
|
191
216
|
simplecov-html (0.10.2)
|
192
|
-
|
193
|
-
|
194
|
-
rack (> 1, < 3)
|
195
|
-
sprockets-rails (3.2.2)
|
196
|
-
actionpack (>= 4.0)
|
197
|
-
activesupport (>= 4.0)
|
198
|
-
sprockets (>= 3.0.0)
|
199
|
-
sqlite3 (1.4.2)
|
217
|
+
sqlite3 (1.6.3-arm64-darwin)
|
218
|
+
sqlite3 (1.6.3-x86_64-linux)
|
200
219
|
sync (0.5.0)
|
201
220
|
term-ansicolor (1.7.1)
|
202
221
|
tins (~> 1.0)
|
203
|
-
thor (1.
|
204
|
-
|
222
|
+
thor (1.2.2)
|
223
|
+
timeout (0.4.0)
|
224
|
+
tins (1.32.1)
|
205
225
|
sync
|
206
|
-
tzinfo (2.0.
|
226
|
+
tzinfo (2.0.6)
|
207
227
|
concurrent-ruby (~> 1.0)
|
208
|
-
unicode-display_width (2.
|
228
|
+
unicode-display_width (2.4.2)
|
209
229
|
websocket-driver (0.7.5)
|
210
230
|
websocket-extensions (>= 0.1.0)
|
211
231
|
websocket-extensions (0.1.5)
|
212
|
-
zeitwerk (2.
|
232
|
+
zeitwerk (2.6.8)
|
213
233
|
|
214
234
|
PLATFORMS
|
215
|
-
|
235
|
+
arm64-darwin-22
|
216
236
|
x86_64-linux
|
217
237
|
|
218
238
|
DEPENDENCIES
|
@@ -228,4 +248,4 @@ DEPENDENCIES
|
|
228
248
|
sqlite3
|
229
249
|
|
230
250
|
BUNDLED WITH
|
231
|
-
2.
|
251
|
+
2.4.15
|
data/README.md
CHANGED
@@ -99,6 +99,20 @@ queued pending finished failed
|
|
99
99
|
|
100
100
|
- `executions`: number of times this job has been executed (which increments on every retry, like after an exception.
|
101
101
|
|
102
|
+
### Disable logging
|
103
|
+
|
104
|
+
If you want to avoid logging a specific job you have to add `disable_job_logs` config option on that job. For example:
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
class MyJob < ActiveJob::Base
|
108
|
+
disable_job_logs
|
109
|
+
|
110
|
+
def perform(param1, param2)
|
111
|
+
# ...
|
112
|
+
end
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
102
116
|
### Important
|
103
117
|
|
104
118
|
If your job calls the `rescue_from` method, you will need to call the `fail_job` method explicitly to log the job completion. For example:
|
@@ -3,6 +3,8 @@ module ActiveJobLog
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
+
class_attribute :disabled_log
|
7
|
+
|
6
8
|
before_enqueue { |job| enqueue_job(job) }
|
7
9
|
before_perform { |job| execute_job(job) }
|
8
10
|
after_perform { |job| finish_job(job) }
|
@@ -11,31 +13,48 @@ module ActiveJobLog
|
|
11
13
|
fail_job(exception)
|
12
14
|
raise exception
|
13
15
|
end
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
class_methods do
|
19
|
+
def disable_job_logs
|
20
|
+
self.disabled_log = true
|
17
21
|
end
|
22
|
+
end
|
18
23
|
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
def enqueue_job(job)
|
25
|
+
update_job!(job.job_id, :queued, init_params(job))
|
26
|
+
end
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
28
|
+
def execute_job(job)
|
29
|
+
update_job!(job.job_id, :pending, init_params(job))
|
30
|
+
end
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
def finish_job(job)
|
33
|
+
update_job!(job.job_id, :finished)
|
34
|
+
end
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
def fail_job(exception)
|
37
|
+
update_job!(
|
38
|
+
job_id,
|
39
|
+
:failed,
|
40
|
+
error: exception.message,
|
41
|
+
stack_trace: exception.backtrace
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def update_job!(job_id, status, params = {})
|
46
|
+
return if self.class.disabled_log
|
47
|
+
|
48
|
+
Job.update_job!(job_id, status, params)
|
49
|
+
end
|
50
|
+
|
51
|
+
def init_params(job)
|
52
|
+
{
|
53
|
+
job_class: self.class.name,
|
54
|
+
params: job.arguments,
|
55
|
+
executions: job.try(:executions),
|
56
|
+
queue_name: job.queue_name
|
57
|
+
}
|
39
58
|
end
|
40
59
|
end
|
41
60
|
end
|
@@ -1,15 +1,9 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
RSpec.describe ActiveJobLog::LogExt do
|
4
|
-
def
|
5
|
-
|
6
|
-
rescue
|
7
|
-
nil
|
8
|
-
end
|
9
|
-
|
10
|
-
def perform_now
|
11
|
-
TestJob.perform_now(*job_params)
|
12
|
-
rescue
|
4
|
+
def perform_now(job_class)
|
5
|
+
job_class.perform_now(*job_params)
|
6
|
+
rescue StandardError
|
13
7
|
nil
|
14
8
|
end
|
15
9
|
|
@@ -17,19 +11,21 @@ RSpec.describe ActiveJobLog::LogExt do
|
|
17
11
|
%w{p1 p2}
|
18
12
|
end
|
19
13
|
|
20
|
-
before { remove_job_class }
|
21
|
-
|
22
14
|
it { expect(ActiveJobLog::Job.count).to eq(0) }
|
23
15
|
|
24
16
|
context "with successful job" do
|
25
|
-
|
26
|
-
|
17
|
+
let(:job_class) do
|
18
|
+
klass = Class.new(ApplicationJob) do
|
27
19
|
def perform(param1, param2)
|
28
20
|
"success with #{param1} and #{param2}"
|
29
21
|
end
|
30
22
|
end
|
31
23
|
|
32
|
-
|
24
|
+
stub_const('TestJob', klass)
|
25
|
+
end
|
26
|
+
|
27
|
+
before do
|
28
|
+
perform_now(job_class)
|
33
29
|
@job = ActiveJobLog::Job.last
|
34
30
|
end
|
35
31
|
|
@@ -51,14 +47,18 @@ RSpec.describe ActiveJobLog::LogExt do
|
|
51
47
|
end
|
52
48
|
|
53
49
|
context "with failed job" do
|
54
|
-
|
55
|
-
|
50
|
+
let(:job_class) do
|
51
|
+
klass = Class.new(ApplicationJob) do
|
56
52
|
def perform(_param1, _param2)
|
57
53
|
raise "error"
|
58
54
|
end
|
59
55
|
end
|
60
56
|
|
61
|
-
|
57
|
+
stub_const('TestJob', klass)
|
58
|
+
end
|
59
|
+
|
60
|
+
before do
|
61
|
+
perform_now(job_class)
|
62
62
|
@job = ActiveJobLog::Job.last
|
63
63
|
end
|
64
64
|
|
@@ -78,4 +78,37 @@ RSpec.describe ActiveJobLog::LogExt do
|
|
78
78
|
it { expect(@job.total_duration).not_to be_nil }
|
79
79
|
it { expect(@job.executions).to eq(1) }
|
80
80
|
end
|
81
|
+
|
82
|
+
context "with disabled jobs" do
|
83
|
+
let(:disabled_job_class) do
|
84
|
+
klass = Class.new(ApplicationJob) do
|
85
|
+
disable_job_logs
|
86
|
+
|
87
|
+
def perform(_param1, _param2)
|
88
|
+
# ...
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
stub_const('DisabledTestJob', klass)
|
93
|
+
end
|
94
|
+
|
95
|
+
let(:enabled_job_class) do
|
96
|
+
klass = Class.new(ApplicationJob) do
|
97
|
+
def perform(_param1, _param2)
|
98
|
+
# ...
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
stub_const('EnabledTestJob', klass)
|
103
|
+
end
|
104
|
+
|
105
|
+
before do
|
106
|
+
perform_now(disabled_job_class)
|
107
|
+
perform_now(enabled_job_class)
|
108
|
+
@job = ActiveJobLog::Job.last
|
109
|
+
end
|
110
|
+
|
111
|
+
it { expect(ActiveJobLog::Job.count).to eq(1) }
|
112
|
+
it { expect(@job.job_class).to eq('EnabledTestJob') }
|
113
|
+
end
|
81
114
|
end
|
data/spec/rails_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_job_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Platanus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -239,7 +239,6 @@ files:
|
|
239
239
|
- spec/dummy/config/environments/production.rb
|
240
240
|
- spec/dummy/config/environments/test.rb
|
241
241
|
- spec/dummy/config/initializers/application_controller_renderer.rb
|
242
|
-
- spec/dummy/config/initializers/assets.rb
|
243
242
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
244
243
|
- spec/dummy/config/initializers/content_security_policy.rb
|
245
244
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
@@ -287,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
286
|
- !ruby/object:Gem::Version
|
288
287
|
version: '0'
|
289
288
|
requirements: []
|
290
|
-
rubygems_version: 3.
|
289
|
+
rubygems_version: 3.4.10
|
291
290
|
signing_key:
|
292
291
|
specification_version: 4
|
293
292
|
summary: Rails engine to keep jobs history
|
@@ -310,7 +309,6 @@ test_files:
|
|
310
309
|
- spec/dummy/bin/rails
|
311
310
|
- spec/dummy/bin/rake
|
312
311
|
- spec/dummy/bin/setup
|
313
|
-
- spec/dummy/config.ru
|
314
312
|
- spec/dummy/config/application.rb
|
315
313
|
- spec/dummy/config/boot.rb
|
316
314
|
- spec/dummy/config/cable.yml
|
@@ -320,7 +318,6 @@ test_files:
|
|
320
318
|
- spec/dummy/config/environments/production.rb
|
321
319
|
- spec/dummy/config/environments/test.rb
|
322
320
|
- spec/dummy/config/initializers/application_controller_renderer.rb
|
323
|
-
- spec/dummy/config/initializers/assets.rb
|
324
321
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
325
322
|
- spec/dummy/config/initializers/content_security_policy.rb
|
326
323
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
@@ -333,6 +330,7 @@ test_files:
|
|
333
330
|
- spec/dummy/config/puma.rb
|
334
331
|
- spec/dummy/config/routes.rb
|
335
332
|
- spec/dummy/config/storage.yml
|
333
|
+
- spec/dummy/config.ru
|
336
334
|
- spec/dummy/db/schema.rb
|
337
335
|
- spec/dummy/package.json
|
338
336
|
- spec/dummy/public/404.html
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version = '1.0'
|
5
|
-
|
6
|
-
# Add additional assets to the asset load path.
|
7
|
-
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
-
|
9
|
-
# Precompile additional assets.
|
10
|
-
# application.js, application.css, and all non-JS/CSS in the app/assets
|
11
|
-
# folder are already added.
|
12
|
-
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|