job_notifier 1.5.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +104 -0
  3. data/.circleci/setup-rubygems.sh +3 -0
  4. data/.rubocop.yml +65 -594
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile.lock +187 -124
  8. data/README.md +10 -1
  9. data/app/models/job_notifier/job.rb +3 -2
  10. data/job_notifier.gemspec +9 -5
  11. data/lib/job_notifier/notifier.rb +5 -5
  12. data/lib/job_notifier/version.rb +1 -1
  13. data/spec/dummy/Rakefile +1 -1
  14. data/spec/dummy/app/assets/config/manifest.js +3 -0
  15. data/spec/dummy/app/assets/stylesheets/application.css +3 -3
  16. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  17. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  18. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  19. data/spec/dummy/app/javascript/packs/application.js +15 -0
  20. data/spec/dummy/app/jobs/application_job.rb +7 -0
  21. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  22. data/spec/dummy/app/models/application_record.rb +3 -0
  23. data/spec/dummy/app/views/layouts/application.html.erb +10 -9
  24. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  25. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  26. data/spec/dummy/bin/rails +3 -3
  27. data/spec/dummy/bin/rake +2 -2
  28. data/spec/dummy/bin/setup +18 -14
  29. data/spec/dummy/config.ru +3 -1
  30. data/spec/dummy/config/application.rb +12 -21
  31. data/spec/dummy/config/boot.rb +3 -3
  32. data/spec/dummy/config/cable.yml +10 -0
  33. data/spec/dummy/config/database.yml +2 -2
  34. data/spec/dummy/config/environment.rb +1 -1
  35. data/spec/dummy/config/environments/development.rb +49 -14
  36. data/spec/dummy/config/environments/production.rb +63 -22
  37. data/spec/dummy/config/environments/test.rb +29 -12
  38. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  39. data/spec/dummy/config/initializers/assets.rb +4 -3
  40. data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -3
  41. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  42. data/spec/dummy/config/initializers/cookies_serializer.rb +2 -0
  43. data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
  44. data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
  45. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
  46. data/spec/dummy/config/locales/en.yml +11 -1
  47. data/spec/dummy/config/puma.rb +43 -0
  48. data/spec/dummy/config/routes.rb +0 -1
  49. data/spec/dummy/config/storage.yml +34 -0
  50. data/spec/dummy/public/404.html +6 -6
  51. data/spec/dummy/public/422.html +6 -6
  52. data/spec/dummy/public/500.html +6 -6
  53. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  54. data/spec/dummy/public/apple-touch-icon.png +0 -0
  55. data/spec/factories/job_notifier_jobs.rb +3 -3
  56. data/spec/lib/job_notifier/notifier_spec.rb +8 -8
  57. data/spec/spec_helper.rb +2 -0
  58. metadata +94 -18
  59. data/.travis.yml +0 -14
@@ -8,6 +8,7 @@ RSpec.describe JobNotifier::Notifier do
8
8
  class TestUser
9
9
  include JobNotifier::Identifier
10
10
  attr_accessor :email
11
+
11
12
  identify_job_through :email
12
13
  end
13
14
 
@@ -40,13 +41,14 @@ RSpec.describe JobNotifier::Notifier do
40
41
  end
41
42
 
42
43
  def job_by_identifier(identifier)
44
+ sleep(1)
43
45
  JobNotifier::Job.where(identifier: identifier).first
44
46
  end
45
47
 
46
48
  context "defining perform_with_feedback" do
47
49
  context "with success feedback" do
48
50
  before do
49
- class ImageUploadJob < ActiveJob::Base
51
+ class ImageUploadJob < ApplicationJob
50
52
  def perform_with_feedback(param1, param2)
51
53
  "photo loaded! with #{param1} and #{param2}"
52
54
  end
@@ -68,7 +70,7 @@ RSpec.describe JobNotifier::Notifier do
68
70
 
69
71
  context "with error feedback" do
70
72
  before do
71
- class ImageUploadJob < ActiveJob::Base
73
+ class ImageUploadJob < ApplicationJob
72
74
  def perform_with_feedback(_param1, _param2)
73
75
  raise JobNotifier::Error::Validation.new(error: "invalid photo url")
74
76
  end
@@ -90,7 +92,7 @@ RSpec.describe JobNotifier::Notifier do
90
92
 
91
93
  context "with unexpected error" do
92
94
  before do
93
- class ImageUploadJob < ActiveJob::Base
95
+ class ImageUploadJob < ApplicationJob
94
96
  def perform_with_feedback(_param1, _param2)
95
97
  raise "unexpected error"
96
98
  end
@@ -98,9 +100,7 @@ RSpec.describe JobNotifier::Notifier do
98
100
  end
99
101
 
100
102
  it "creates new job but throw the exception" do
101
- expect { ImageUploadJob.perform_later(@identifier, "param1", "param2") }.to(
102
- raise_error(RuntimeError, "unexpected error"))
103
- expect(JobNotifier::Job.count).to eq(1)
103
+ ImageUploadJob.perform_later(@identifier, "param1", "param2")
104
104
  job = job_by_identifier(@identifier)
105
105
  expect(job.result).to eq("unknown")
106
106
  expect(job.status).to eq("failed")
@@ -109,7 +109,7 @@ RSpec.describe JobNotifier::Notifier do
109
109
 
110
110
  context "with no owner" do
111
111
  before do
112
- class ImageUploadJob < ActiveJob::Base
112
+ class ImageUploadJob < ApplicationJob
113
113
  def perform_with_feedback
114
114
  "photo loaded!"
115
115
  end
@@ -127,7 +127,7 @@ RSpec.describe JobNotifier::Notifier do
127
127
 
128
128
  context "without defining perform_with_feedback" do
129
129
  before do
130
- class ImageUploadJob < ActiveJob::Base
130
+ class ImageUploadJob < ApplicationJob
131
131
  def perform
132
132
  # work here
133
133
  end
data/spec/spec_helper.rb CHANGED
@@ -89,4 +89,6 @@ RSpec.configure do |config|
89
89
  # as the one that triggered the failure.
90
90
  Kernel.srand config.seed
91
91
  =end
92
+ config.filter_run :focus
93
+ config.run_all_when_everything_filtered = true
92
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platanus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-09-26 00:00:00.000000000 Z
13
+ date: 2021-06-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 4.2.0
21
+ version: '6.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 4.2.0
28
+ version: '6.0'
29
29
  - !ruby/object:Gem::Dependency
30
- name: enumerize
30
+ name: colorize
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: '1.0'
35
+ version: 0.7.7
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '1.0'
42
+ version: 0.7.7
43
43
  - !ruby/object:Gem::Dependency
44
- name: colorize
44
+ name: enumerize
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.7.7
49
+ version: '1.0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 0.7.7
56
+ version: '1.0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: silencer
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +68,34 @@ dependencies:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
70
  version: 1.0.0.rc3
71
+ - !ruby/object:Gem::Dependency
72
+ name: coveralls
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: factory_bot_rails
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
71
99
  - !ruby/object:Gem::Dependency
72
100
  name: pry
73
101
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +111,7 @@ dependencies:
83
111
  - !ruby/object:Gem::Version
84
112
  version: '0'
85
113
  - !ruby/object:Gem::Dependency
86
- name: sqlite3
114
+ name: rspec_junit_formatter
87
115
  requirement: !ruby/object:Gem::Requirement
88
116
  requirements:
89
117
  - - ">="
@@ -98,20 +126,34 @@ dependencies:
98
126
  version: '0'
99
127
  - !ruby/object:Gem::Dependency
100
128
  name: rspec-rails
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ - !ruby/object:Gem::Dependency
142
+ name: rubocop
101
143
  requirement: !ruby/object:Gem::Requirement
102
144
  requirements:
103
145
  - - "~>"
104
146
  - !ruby/object:Gem::Version
105
- version: 3.4.0
147
+ version: '1.9'
106
148
  type: :development
107
149
  prerelease: false
108
150
  version_requirements: !ruby/object:Gem::Requirement
109
151
  requirements:
110
152
  - - "~>"
111
153
  - !ruby/object:Gem::Version
112
- version: 3.4.0
154
+ version: '1.9'
113
155
  - !ruby/object:Gem::Dependency
114
- name: factory_bot_rails
156
+ name: rubocop-rails
115
157
  requirement: !ruby/object:Gem::Requirement
116
158
  requirements:
117
159
  - - ">="
@@ -125,7 +167,7 @@ dependencies:
125
167
  - !ruby/object:Gem::Version
126
168
  version: '0'
127
169
  - !ruby/object:Gem::Dependency
128
- name: coveralls
170
+ name: sqlite3
129
171
  requirement: !ruby/object:Gem::Requirement
130
172
  requirements:
131
173
  - - ">="
@@ -148,13 +190,14 @@ executables: []
148
190
  extensions: []
149
191
  extra_rdoc_files: []
150
192
  files:
193
+ - ".circleci/config.yml"
194
+ - ".circleci/setup-rubygems.sh"
151
195
  - ".coveralls.yml"
152
196
  - ".gitignore"
153
197
  - ".hound.yml"
154
198
  - ".rspec"
155
199
  - ".rubocop.yml"
156
200
  - ".ruby-version"
157
- - ".travis.yml"
158
201
  - CHANGELOG.md
159
202
  - Gemfile
160
203
  - Gemfile.lock
@@ -188,14 +231,23 @@ files:
188
231
  - lib/tasks/job_notifier_tasks.rake
189
232
  - spec/dummy/README.rdoc
190
233
  - spec/dummy/Rakefile
234
+ - spec/dummy/app/assets/config/manifest.js
191
235
  - spec/dummy/app/assets/javascripts/application.js
192
236
  - spec/dummy/app/assets/stylesheets/application.css
237
+ - spec/dummy/app/channels/application_cable/channel.rb
238
+ - spec/dummy/app/channels/application_cable/connection.rb
193
239
  - spec/dummy/app/controllers/application_controller.rb
194
240
  - spec/dummy/app/controllers/home_controller.rb
195
241
  - spec/dummy/app/helpers/application_helper.rb
242
+ - spec/dummy/app/javascript/packs/application.js
243
+ - spec/dummy/app/jobs/application_job.rb
244
+ - spec/dummy/app/mailers/application_mailer.rb
245
+ - spec/dummy/app/models/application_record.rb
196
246
  - spec/dummy/app/models/user.rb
197
247
  - spec/dummy/app/views/home/index.html.erb
198
248
  - spec/dummy/app/views/layouts/application.html.erb
249
+ - spec/dummy/app/views/layouts/mailer.html.erb
250
+ - spec/dummy/app/views/layouts/mailer.text.erb
199
251
  - spec/dummy/bin/bundle
200
252
  - spec/dummy/bin/rails
201
253
  - spec/dummy/bin/rake
@@ -203,27 +255,35 @@ files:
203
255
  - spec/dummy/config.ru
204
256
  - spec/dummy/config/application.rb
205
257
  - spec/dummy/config/boot.rb
258
+ - spec/dummy/config/cable.yml
206
259
  - spec/dummy/config/database.yml
207
260
  - spec/dummy/config/environment.rb
208
261
  - spec/dummy/config/environments/development.rb
209
262
  - spec/dummy/config/environments/production.rb
210
263
  - spec/dummy/config/environments/test.rb
264
+ - spec/dummy/config/initializers/application_controller_renderer.rb
211
265
  - spec/dummy/config/initializers/assets.rb
212
266
  - spec/dummy/config/initializers/backtrace_silencers.rb
267
+ - spec/dummy/config/initializers/content_security_policy.rb
213
268
  - spec/dummy/config/initializers/cookies_serializer.rb
214
269
  - spec/dummy/config/initializers/filter_parameter_logging.rb
215
270
  - spec/dummy/config/initializers/inflections.rb
216
271
  - spec/dummy/config/initializers/job_notifier.rb
217
272
  - spec/dummy/config/initializers/mime_types.rb
273
+ - spec/dummy/config/initializers/permissions_policy.rb
218
274
  - spec/dummy/config/initializers/session_store.rb
219
275
  - spec/dummy/config/initializers/wrap_parameters.rb
220
276
  - spec/dummy/config/locales/en.yml
277
+ - spec/dummy/config/puma.rb
221
278
  - spec/dummy/config/routes.rb
222
279
  - spec/dummy/config/secrets.yml
280
+ - spec/dummy/config/storage.yml
223
281
  - spec/dummy/db/schema.rb
224
282
  - spec/dummy/public/404.html
225
283
  - spec/dummy/public/422.html
226
284
  - spec/dummy/public/500.html
285
+ - spec/dummy/public/apple-touch-icon-precomposed.png
286
+ - spec/dummy/public/apple-touch-icon.png
227
287
  - spec/dummy/public/favicon.ico
228
288
  - spec/factories/job_notifier_jobs.rb
229
289
  - spec/lib/job_notifier/adapters_spec.rb
@@ -252,22 +312,30 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
312
  - !ruby/object:Gem::Version
253
313
  version: '0'
254
314
  requirements: []
255
- rubyforge_project:
256
- rubygems_version: 2.7.7
315
+ rubygems_version: 3.1.6
257
316
  signing_key:
258
317
  specification_version: 4
259
318
  summary: Rails engine to persist job results and notify job status changes
260
319
  test_files:
261
320
  - spec/dummy/README.rdoc
262
321
  - spec/dummy/Rakefile
322
+ - spec/dummy/app/assets/config/manifest.js
263
323
  - spec/dummy/app/assets/javascripts/application.js
264
324
  - spec/dummy/app/assets/stylesheets/application.css
325
+ - spec/dummy/app/channels/application_cable/channel.rb
326
+ - spec/dummy/app/channels/application_cable/connection.rb
265
327
  - spec/dummy/app/controllers/application_controller.rb
266
328
  - spec/dummy/app/controllers/home_controller.rb
267
329
  - spec/dummy/app/helpers/application_helper.rb
330
+ - spec/dummy/app/javascript/packs/application.js
331
+ - spec/dummy/app/jobs/application_job.rb
332
+ - spec/dummy/app/mailers/application_mailer.rb
333
+ - spec/dummy/app/models/application_record.rb
268
334
  - spec/dummy/app/models/user.rb
269
335
  - spec/dummy/app/views/home/index.html.erb
270
336
  - spec/dummy/app/views/layouts/application.html.erb
337
+ - spec/dummy/app/views/layouts/mailer.html.erb
338
+ - spec/dummy/app/views/layouts/mailer.text.erb
271
339
  - spec/dummy/bin/bundle
272
340
  - spec/dummy/bin/rails
273
341
  - spec/dummy/bin/rake
@@ -275,27 +343,35 @@ test_files:
275
343
  - spec/dummy/config.ru
276
344
  - spec/dummy/config/application.rb
277
345
  - spec/dummy/config/boot.rb
346
+ - spec/dummy/config/cable.yml
278
347
  - spec/dummy/config/database.yml
279
348
  - spec/dummy/config/environment.rb
280
349
  - spec/dummy/config/environments/development.rb
281
350
  - spec/dummy/config/environments/production.rb
282
351
  - spec/dummy/config/environments/test.rb
352
+ - spec/dummy/config/initializers/application_controller_renderer.rb
283
353
  - spec/dummy/config/initializers/assets.rb
284
354
  - spec/dummy/config/initializers/backtrace_silencers.rb
355
+ - spec/dummy/config/initializers/content_security_policy.rb
285
356
  - spec/dummy/config/initializers/cookies_serializer.rb
286
357
  - spec/dummy/config/initializers/filter_parameter_logging.rb
287
358
  - spec/dummy/config/initializers/inflections.rb
288
359
  - spec/dummy/config/initializers/job_notifier.rb
289
360
  - spec/dummy/config/initializers/mime_types.rb
361
+ - spec/dummy/config/initializers/permissions_policy.rb
290
362
  - spec/dummy/config/initializers/session_store.rb
291
363
  - spec/dummy/config/initializers/wrap_parameters.rb
292
364
  - spec/dummy/config/locales/en.yml
365
+ - spec/dummy/config/puma.rb
293
366
  - spec/dummy/config/routes.rb
294
367
  - spec/dummy/config/secrets.yml
368
+ - spec/dummy/config/storage.yml
295
369
  - spec/dummy/db/schema.rb
296
370
  - spec/dummy/public/404.html
297
371
  - spec/dummy/public/422.html
298
372
  - spec/dummy/public/500.html
373
+ - spec/dummy/public/apple-touch-icon-precomposed.png
374
+ - spec/dummy/public/apple-touch-icon.png
299
375
  - spec/dummy/public/favicon.ico
300
376
  - spec/factories/job_notifier_jobs.rb
301
377
  - spec/lib/job_notifier/adapters_spec.rb
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- script:
5
- - RAILS_ENV=test bundle exec rake db:create db:migrate
6
- - bundle exec rspec spec
7
- deploy:
8
- provider: rubygems
9
- api_key:
10
- secure: fBY8nWttRTNvD1AdU9+ZNa7CODLljATiEqfHXXvYCZsJhPgH8Ht0SMqOKCQEzbqIrjIMEy38TWhXFRrvLfnBAwCAL1U9AZY9bNpJK7BIGd7qaIsCL0iVssRJPLvw0O1ZBvzE9ppwhsv+UQc6F0YtzRBZ5+eNoEREiywXX5gVus9xWkrni2BL3mbaoXAc9IuIkulVuFXZOTOK/ZPPkvEJ2WTynhLjEAZv0+ctWdrbo02cfwh8dpgnQ4+jH97s3erLO146AySNibkJpf0DsQHwF+mn6FoCGsLmDsMpomU52HYQz5V/RHYHjijqXrr39EwOh/wVP/MhlvYKGWSfBurixcXcHFxfT2MeNmeuvpp9n8R5q82ZqFZ7eqJS1K+aTE8O5EBWnHmy7GVPkfO0NiZnllYKlynJI9njF0060Zbj7uEl8NTHa6zdlEm8lCNHV5anlcNAIFffW8yImCGLgyevalhPGy/Sq/zeFNYyPKRxAlot7FdUuIoAINRxgo0/jupc8hMCEz5/oTY3jZGVdfIFnMHde5tSZG2sb8xCy0owvvCZ/0nDtLYWxrdVyw/mwT6YUrRUdCgPACCV9Qd/Wc21+8EJ1EjXbZvNLXgtM/nmHIoneRlBFpIIrEBVc9h6R7dqwo9NuoLfdOGNxvbHxi7AxguL7/E4GFcdRrlRELqPht8=
11
- gem: job_notifier
12
- on:
13
- tags: true
14
- repo: platanus/job_notifier