Commit graph

13415 commits

Author SHA1 Message Date
kara Diaby
f1f2b76a3d revisions 2021-10-27 12:00:39 +02:00
kara Diaby
71aa13f468 tests 2021-10-27 12:00:39 +02:00
kara Diaby
c2fcd3992d add other option for dropdown select 2021-10-26 16:11:15 +02:00
kara Diaby
0e65916e44 add other option for dropdown radio 2021-10-26 16:11:15 +02:00
kara Diaby
dc35d9521f add other option to liste deroulante champ 2021-10-26 16:11:15 +02:00
Pierre de La Morinerie
8bc925ae50
Merge pull request #6584 from betagouv/system-specs
Migration des tests d'intégration vers des "system specs" (#6584)
2021-10-26 12:43:30 +02:00
Pierre de La Morinerie
9fd38cae5e specs: migrate from features to system specs
System specs have been available since Rails 5.1, and are better
integrated with the Rails framework.

- Rename `spec/features` to `spec/system`
- Rename `feature do` to `describe do`
- Configure Capybara for system specs

Steps mostly taken from https://medium.com/table-xi/a-quick-guide-to-rails-system-tests-in-rspec-b6e9e8a8b5f6
2021-10-26 12:24:46 +02:00
Pierre de La Morinerie
df9fa258ae specs: remove database_cleaner
This is not needed for integration tests since Rails 5.1.

See https://www.nicholasjacques.io/blog/you-probably-dont-need-databasecleaner/
2021-10-26 12:24:46 +02:00
Pierre de La Morinerie
b1eee27dd7 specs: remove outdated workaround for silencing puma logs 2021-10-26 12:24:46 +02:00
Paul Chavard
afe2f7453e
Merge pull request #6564 from tchak/feat-improuve-linked_drop_down_list
Ajouter la possibilité de spécifier le libellé et la description pour les menus déroulants secondaires
2021-10-26 12:24:33 +02:00
Paul Chavard
6e8e0c7b6b feat(type_de_champ): reflect changes of secondary labels and descriptions 2021-10-26 12:18:01 +02:00
Paul Chavard
d308448f02 feat(type_de_champ): add secondary label and description do linked drop downs 2021-10-26 12:18:01 +02:00
Pierre de La Morinerie
21e0c41b5d
Merge pull request #6583 from betagouv/improve-some-factories 2021-10-26 12:12:11 +02:00
Pierre de La Morinerie
cedbd31d39 specs: only build an admin when building a procedure
This should slighly be faster than doing a create in the middle of the
build.
2021-10-26 12:03:30 +02:00
Pierre de La Morinerie
a2b91c8ec6 factories: cleanup Administrateur, Instructeur and Expert factories
This changes:

- avoids relying on application code to create mock objects,
- allows to build Administrateur or Instructeurs without saving them.
2021-10-26 12:03:30 +02:00
Pierre de La Morinerie
0ff95df221 specs: improve speed of phone_champ_spec
Re-use the same champ for each test. This is safe, and makes the test
go from 4s to 1s.
2021-10-26 12:03:30 +02:00
Pierre de La Morinerie
fccf75710a specs: avoid creating uneeded champs on geo_area
It makes the test much faster.
2021-10-26 12:03:30 +02:00
Paul Chavard
05293ad849
Merge pull request #6574 from tchak/fix-discarded-dossiers-deletion
fix(dossier): fix dossier.avis cascade
2021-10-26 12:01:10 +02:00
Paul Chavard
579dce8eb6 refactor(user): wrap user destruction in a transaction 2021-10-26 11:16:29 +02:00
Paul Chavard
d5d3995dad fix(dossier): fix dossier.avis cascade 2021-10-26 11:16:29 +02:00
Paul Chavard
6eae97944d
Merge pull request #6576 from tchak/fix-remove-discarded-dossiers-from-transfers
fix(transfer): remove discarded dossiers from transfers
2021-10-26 11:04:07 +02:00
Paul Chavard
4aa573a75d fix(transfer): remove discarded dossiers from transfers 2021-10-26 10:41:01 +02:00
Pierre de La Morinerie
01b0d15f5a
Merge pull request #6566 from betagouv/cache-pasword-complexity 2021-10-25 15:48:32 +02:00
Pierre de La Morinerie
d0e87a08cf services: cache zxcvbn dictionaries per-thread
Before, every time a password was tested, the dictionaries were parsed
again by zxcvbn.

Parsing dictionaries is slow: it may take up to ~1s. This doesn't matter
that much in production, but it makes tests very slow (because we tend
to create a lot of User records).

With this changes, the initializer tester is shared between calls, class
instances and threads. It is lazily loaded on first use, in order not to
slow down the application boot sequence.

This uses ~20 Mo of memory (only once for all threads), but makes tests
more that twice faster.

For instance, model tests go from **8m 21s** to **3m 26s**.

NB:
An additionnal optimization could be to preload the tester on
boot, before workers are forked, to take advantage of Puma copy-on-write
mechanism. In this way all forked workers would use the same cached
instance.

But:

- We're not actually sure this would work properly. What if Ruby updates
  an interval ivar on the class, and this forces the OS to copy the
  whole data structure in each fork?
- Puma phased restarts are not compatible with copy-on-write anyway.

So we're avoiding this optimisation for now, and take the extra 20 Mo
per worker.
2021-10-25 12:04:56 +02:00
Pierre de La Morinerie
5818841daa
Merge pull request #6581 from betagouv/remove-puma-boot-code 2021-10-25 11:48:03 +02:00
Pierre de La Morinerie
136d0bc341 config: remove pre and post boot code from puma config
This is no longer needed since Rails 5.1.

See https://github.com/rails/rails/pull/31241
2021-10-25 11:28:09 +02:00
Paul Chavard
422265886a
Merge pull request #6573 from tchak/fix-purge-stale-transfers
fix(transfer): manually nullify staled transfers references
2021-10-21 14:58:28 +02:00
Paul Chavard
1561ea82f6 fix(transfer): manually nullify staled transfers references 2021-10-21 13:54:26 +02:00
Paul Chavard
68899715e0
Merge pull request #6465 from tchak/dossier-rebase
Rebase dossiers en brouillon
2021-10-21 11:31:12 +02:00
Paul Chavard
2a3a9dd822 feat(revisions): rebase dossiers brouillons 2021-10-20 17:26:09 +02:00
Paul Chavard
09a09d3fcf feat(revisions): add rebased_at to champs 2021-10-20 17:26:09 +02:00
Paul Chavard
67e98f79c9 feat(revisions): add stable_id to changes 2021-10-20 17:25:34 +02:00
Paul Chavard
7cf82c6dfb
Merge pull request #6571 from tchak/fix-improuve-export
Améliorer les perfs des exports
2021-10-20 17:18:08 +02:00
Paul Chavard
1ca8192864 perf(export): load dossiers.champs in batches 2021-10-20 16:52:38 +02:00
Paul Chavard
7e5d388ef8 fix(export): add index on champs.etablissement_id 2021-10-20 16:51:41 +02:00
Pierre de La Morinerie
5479a76e31
Merge pull request #6560 from betagouv/update-phonelib
Gems : mise à jour de phonelib (#6560)
2021-10-20 09:38:27 +02:00
Pierre de La Morinerie
2ad9955e10 gems: update phonelib
Fixes a warning during tests:

> /home/runner/work/demarches-simplifiees.fr/demarches-simplifiees.fr/vendor/bundle/ruby/2.7.0/gems/phonelib-0.6.48/lib/validators/phone_validator.rb:65: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
> /home/runner/work/demarches-simplifiees.fr/demarches-simplifiees.fr/vendor/bundle/ruby/2.7.0/gems/activemodel-6.1.4.1/lib/active_model/errors.rb:404: warning: The called method `add' is defined here
2021-10-20 09:34:56 +02:00
LeSim
6535b31d09
Merge pull request #6562 from betagouv/adapt_admin_whitelist
modifie la liste des domaines en liste blanche
2021-10-19 21:16:07 +02:00
simon lehericey
738d08a1d9 change in whitelist 2021-10-19 21:07:24 +02:00
lydiasan
fc891a2b22
Merge pull request #6440 from betagouv/i18n-selector
i18n: affichage du sélecteur de langues pour les navigateurs non-francophones
2021-10-19 18:17:43 +02:00
lydiasan
6f9c3abfbc i18n: display language selector on non-french accept-languages 2021-10-19 16:41:36 +02:00
Pierre de La Morinerie
7b6420d427 specs: set i18n cookie before running browser specs
Otherwise the browser specs use the dault browser language, which may
be English depending on the system language.
2021-10-19 16:41:36 +02:00
Pierre de La Morinerie
0de8fd23c7 specs: remove invalid js: true specifier
Views specs cant't run Javascript.
2021-10-19 16:41:36 +02:00
LeSim
39a5d80a53
Merge pull request #6552 from betagouv/a_super_admin_can_merge_admin
Un super administrateur peut changer l'email d'un administrateur
2021-10-19 16:22:47 +02:00
simon lehericey
d19ad2840c rename preexisting to targeted, remove duplicated test 2021-10-19 16:12:42 +02:00
simon lehericey
52b7e85954 merge administrateur in user_controller 2021-10-19 16:12:42 +02:00
simon lehericey
866df74706 merge admin 2021-10-19 16:12:42 +02:00
LeSim
c15e1a6de4
Merge pull request #6551 from betagouv/allow_some_instructeur_to_change_their_profile
Laisse les instructeurs changer leur emails vers des domaines autorisés
2021-10-19 16:03:29 +02:00
simon lehericey
44c880adc4 allow instructeur and administrateur to change their email to legit domain (#6550) 2021-10-19 15:54:57 +02:00
Paul Chavard
8616a06937
Merge pull request #6548 from tchak/feat-add-admin-from-manager
feat(manager): bring back add administrateur
2021-10-19 13:21:29 +02:00