Commit graph

256 commits

Author SHA1 Message Date
kara Diaby
6ebd57640c tests 2021-06-15 19:36:46 +02:00
François Vantomme
99086a63be Fix (Instructeur): deal nicely with non-guaranteed elements order in arrays
Use of one-dimension arrays comparison & `contain_exactly` RSpec matcher
to avoid this behaviour:

Failures:
  1) InstructeursImportService#import when an email is malformed ignores or corrects
     Failure/Error:
       expect(procedure_groupes).to match_array([
         ["Occitanie", ["paul@mccartney.uk", "ringo@starr.uk"]],
         ["défaut", []]
       ])
       expected collection contained:  [["Occitanie", ["paul@mccartney.uk", "ringo@starr.uk"]], ["défaut", []]]
       actual collection contained:    [["Occitanie", ["ringo@starr.uk", "paul@mccartney.uk"]], ["défaut", []]]
       the missing elements were:      [["Occitanie", ["paul@mccartney.uk", "ringo@starr.uk"]]]
       the extra elements were:        [["Occitanie", ["ringo@starr.uk", "paul@mccartney.uk"]]]
     # ./spec/services/instructeurs_import_service_spec.rb:70:in `block (4 levels) in <main>'
2021-05-27 08:33:52 +02:00
simon lehericey
17617fba43 address champ needs the data column 2021-05-19 15:59:18 +02:00
simon lehericey
a46000dc1f ensure to_s is used on specialized champ 2021-05-19 09:39:20 +02:00
Paul Chavard
e043645a88 cleanup tests 2021-05-18 11:42:10 +02:00
kara Diaby
468e9e849a tests 2021-05-18 11:42:10 +02:00
simon lehericey
9fd1c604a1 display follower instructeur emails in alphabetic order 2021-05-04 16:38:34 +02:00
Christophe Robillard
01f180022b prend en compte uniquement les pj pour estimer la taille d'un dossier 2021-05-04 12:50:12 +02:00
Christophe Robillard
3d04221dab generate pdf export for dossier only on demand 2021-04-29 17:30:38 +02:00
Christophe Robillard
f40d96fbd2 Revert "Revert "Export de tous les dossier d'une démarche""
This reverts commit d9a588b52e.
2021-04-29 17:29:47 +02:00
krichtof
d9a588b52e
Revert "Export de tous les dossier d'une démarche" 2021-04-29 16:07:18 +02:00
simon lehericey
7b94c2de88 remove extra Dossier call in projection 2021-04-29 11:46:00 +02:00
simon lehericey
db23a853a9 fetch all notification at once 2021-04-29 11:23:41 +02:00
Christophe Robillard
dfbe004122 rename content_type to time_span_type for archives 2021-04-28 11:40:58 +02:00
Christophe Robillard
9134114c2e fix rubocop offenses 2021-04-28 11:40:58 +02:00
Christophe Robillard
8bee53fe77 rend plus robuste la création de l'archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
07cc4fa97f add service to create procedure archive 2021-04-28 11:40:58 +02:00
Christophe Robillard
fba0d78153 generate pdf export inside pieces_justificatives_service 2021-04-28 11:40:58 +02:00
simon lehericey
5bfd4ecbbf add DossierProjectionService 2021-04-22 10:46:04 +02:00
Pierre de La Morinerie
9096a3885c specs: fix creating dossiers :en_construction 2021-04-06 12:12:56 +02:00
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
Pierre de La Morinerie
1c77f59f6b specs: fix test failing on March 1st
Because February only has 28 days.
2021-03-02 12:26:28 +01:00
Christophe Robillard
a288a13805 disable france connect authentication for admin and instructeurs 2021-02-10 18:13:47 +01:00
Pierre de La Morinerie
150ddab660 zeitwerk: Api -> API 2021-02-09 13:07:30 +01:00
Pierre de La Morinerie
88ffa10a56 spec: fix rspec raise_error warning
Rspec warns that if there is for example a SyntaxError, the test will
pass (an error was raised, but it wasn't an ArgumentError, so this is
fine).

Instead check that no error occurs whatsoever.
2021-02-09 10:12:32 +01:00
Pierre de La Morinerie
0d101f3f1a views: remove old design's leftbars 2021-02-02 15:33:09 +01:00
Christophe Robillard
792b53beeb import several instructeurs for a routee procedure
Co-authored-by: simon lehericey <mail@simon.lehericey.net>
2021-01-20 15:03:17 +01:00
Paul Chavard
54f2084aef Add annuaire_education champ 2021-01-14 17:57:48 +01:00
simon lehericey
1159494d37 Add test to ensure no titre identite is exported 2020-12-16 17:31:38 +01:00
kara Diaby
f748ccfc9e Appelle l'API entreprise avec le token en Header 2020-12-10 17:49:49 +01:00
clemkeirua
513d4f6ff1 move all the cron jobs in a dedicated directory 2020-12-08 13:22:43 +00:00
simon lehericey
b187244a29 extract and refactor api errors 2020-12-04 17:07:30 +01:00
Keirua
3fa628235e Nettoyage de I18n.transliterate pour les noms de feuilles d'exports
Co-authored-by: LeSim <mail@simon.lehericey.net>
2020-09-29 15:50:19 +00:00
clemkeirua
9714b607aa ensure valid excel worksheet names 2020-09-29 15:50:19 +00:00
simon lehericey
1eb780b0c9 convert sheet_name to ascii before tuncate to 30 to ensure length < 31 bytes 2020-09-29 14:11:06 +02:00
clemkeirua
c19b653581 higher level length sanitization for worksheet length 2020-09-24 14:59:46 +02:00
kara Diaby
cb4e91c405 Add iban type de champ 2020-09-23 15:56:26 +02:00
kara Diaby
5c68d75107 add titre_identite champ 2020-09-18 14:57:08 +02:00
clemkeirua
2b23eefee2 fix tests that now requir an admin user to have a strong password 2020-09-18 11:16:34 +02:00
Paul Chavard
0a70291b90 update services specs to use revisions 2020-09-02 11:26:26 +02:00
Christophe Robillard
f77cc06a91 prend en compte le nom de l'enseigne pour l'établissement 2020-08-20 14:23:02 +02:00
Christophe Robillard
2c56511204 validate api_entreprise_token 2020-07-08 18:59:22 +02:00
Christophe Robillard
a072d35211 use traitement model
when a dossier is terminated (accepte, refuse or classe_sans_suite),
we store now `processed_at` and `motivation` in a traitement instance
2020-07-08 18:15:15 +02:00
Paul Chavard
c9ab80c880 WIP 2020-07-07 18:03:56 +02:00
Pierre de La Morinerie
43569f687e specs: use fixture_file_upload rather than Rack::Test::UploadedFile
This is mostly for consistency (both styles were used before).

Note: we still have to use `Rack::Test::UploadedFile.new` in factories,
because of https://github.com/thoughtbot/factory_bot/issues/385.
2020-07-01 11:13:45 +02:00
Christophe Robillard
ba5fa9aa4b update ApiEntrepriseService
There is now the `create_etablissement` method which
create etablissement with EtablissementAdapter
and enqueue api_entreprise jobs to retrieve
all informations we can get based on SIRET
2020-05-20 11:09:54 +02:00
Pierre de La Morinerie
9f1407b6d7 expiration: fix the mailer arguments
The mailers expect serializable arguments, but were given
ActiveRecord::Relation objects instead. This made the mailers throw an
exception.

But how was that possible ? This code is tested, and the tests were
green.

Well, the specs spy on the mailer implementation, in order to check that
the mailers methods were properly called. Fair enough.

But if the specs mock the mailer code (instead of calling the original
implementation), we may not notice that the original implementation
rejects our method parameters.

Here this is the case: once we actually call the original implementation
the tests start to fail, because some arguments are not converted from
an ActiveRecord::Relation to a serializable array.

This is fixed by ensuring that the mailer code is executed (and doesn't
throw an exception).
2020-05-18 16:24:08 +02:00
Pierre de La Morinerie
b63fa0e6b8 dossier: remove "Birthdate" column from export 2020-05-18 13:14:28 +00:00
Pierre de La Morinerie
00adb006b4 specs: improve ProcedureExportService spec 2020-05-18 13:14:28 +00:00
clemkeirua
36f381a743 fix flacky test 2020-05-07 10:23:28 +02:00