demarches-normaliennes/spec
Pierre de La Morinerie 75a1046315 active_storage: refactor concerns
Follow-up of #5953.

Refactor the concerns with two goals:

- Getting closer from the way ActiveStorage adds its own hooks.
  Usually ActiveStorage does this using an `Attachment#after_create`
  hook, which then delegates to the blob to enqueue the job.
- Enqueuing each job only once. By hooking on `Attachment#after_create`,
  we guarantee each job will be added only once.

We then let the jobs themselves check if they are relevant or not, and
retry or discard themselves if necessary.

We also need to update the tests a bit, because Rails'
`perform_enqueued_jobs(&block)` test helper doesn't honor the `retry_on`
clause of jobs. Instead it forwards the exception to the caller – which
makes the test fail.

Instead we use the inline version of `perform_enqueued_jobs()`, without
a block, which properly ignores errors catched by retry_on.
2021-03-16 11:49:14 +01:00
..
controllers active_storage: refactor concerns 2021-03-16 11:49:14 +01:00
factories Groupe instructeur selector default blank 2021-03-09 14:47:23 +01:00
features active_storage: refactor concerns 2021-03-16 11:49:14 +01:00
fixtures Add api address external data fetch 2021-02-17 19:10:16 +01:00
helpers piecejusticative file validation focus on size 2020-09-25 09:35:16 +00:00
jobs active_storage: refactor concerns 2021-03-16 11:49:14 +01:00
lib Add api address external data fetch 2021-02-17 19:10:16 +01:00
mailers mailers: remove dead AdministrationMailer code 2021-02-04 12:15:13 +01:00
middlewares specs: always require rails_helper 2020-03-31 12:48:32 +02:00
models active_storage: refactor concerns 2021-03-16 11:49:14 +01:00
policies policies: fix champ policy for guest users 2020-04-02 11:27:14 +02:00
serializers fix broken test in champ_serializer_spec 2020-09-25 09:35:16 +00:00
services active_storage: refactor concerns 2021-03-16 11:49:14 +01:00
support spec: better split spec_helper and rails_helper 2021-03-04 22:59:39 +01:00
views Groupe instructeur selector default blank 2021-03-09 14:47:23 +01:00
rails_helper.rb spec: better split spec_helper and rails_helper 2021-03-04 22:59:39 +01:00
spec_helper.rb spec: better split spec_helper and rails_helper 2021-03-04 22:59:39 +01:00