Commit graph

269 commits

Author SHA1 Message Date
Pierre de La Morinerie
aefdd5d2a1 models: require belong_to associations on attestation_template 2020-08-18 15:57:36 +02:00
Christophe Robillard
1253bb5994 store instructeur_email in traitement 2020-07-08 18:15:15 +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
Christophe Robillard
f631acd118 update state date in aasm after callbacks
call aasm event methods, not state methods directly
2020-07-08 18:15:15 +02:00
Pierre de La Morinerie
060bf1f9ca factories: flesh out the default etablissement for a dossier 2020-07-06 11:41:25 +02:00
Paul Chavard
20705d6e30 Do not send draft norifications to users on inactive démarches 2020-05-27 16:36:46 +02:00
Paul Chavard
dfc004d7bb Unarchive dossier when repasser_en_instruction 2020-05-12 19:05:18 +02:00
Paul Chavard
843e033c38 Allow instructeurs to download a GeoJSON document for a given dossier 2020-04-30 15:49:43 +02:00
Paul Chavard
61eaca928f remove WarnExpiringDossiersJob 2020-04-09 11:11:51 +02:00
Paul Chavard
288ace2f34 Dossier on discarded procedure should have access to discarded procedure 2020-03-31 17:08:29 +02:00
Paul Chavard
58c126308c Add DiscardedProceduresDeletionJob job 2020-03-31 17:08:28 +02:00
Paul Chavard
876e05aed3 Discard demarches from manager 2020-03-31 17:08:28 +02:00
Pierre de La Morinerie
4cb747fdb6 specs: always require rails_helper
Test helpers are separated between two files: spec_helper and
rails_helper. This separation is meant to allow tests that do not
require Rails (like testing standalone libs) to boot faster.

The spec_helper file is always loaded, through `--require spec_helper`
in the `.rspec` config file. When needed, the rails_helper file is
expected to be required manually.

This is fine, but:
- Many test files have a redundant `require 'spec_helper'` line;
- Many test files should require `rails_helper`, but don't.

Not requiring `rails_helper` will cause the Rails-concerned section of
the test environment not to be configured–which may cause subtle bugs
(like the test database not being properly initialized).

Moreover, Spring loads all the Rails files on preloading anyway. So the
gains from using only `spec_helper` are thin.

To streamline this process, this commit:
- Configures `.rspec` to require `rails_helper` by default;
- Remove all manual requires to spec_helper or rails_helper.

Reference: https://stackoverflow.com/questions/24145329/how-is-spec-rails-helper-rb-different-from-spec-spec-helper-rb-do-i-need-it
2020-03-31 12:48:32 +02:00
Paul Chavard
c707a21f97 Rename delete_and_keep_track -> discard_and_keep_track 2020-03-26 14:23:23 +01:00
Paul Chavard
c086f6d580 Add a job to remove discarded dossiers 2020-03-25 17:28:25 +01:00
Paul Chavard
5b5ae5a7a5 Do not send notifications or create operation logs on brouillon demarches 2020-03-25 15:04:52 +01:00
maatinito
1af32b29fd #4807 Use now() instead of Date.time.today (better code homogeneity) 2020-03-24 17:09:14 -10:00
maatinito
f5c2dc03c5 #4807 better method/variable naming 2020-03-24 16:46:23 -10:00
Christian Lautier
e61c53f267 Fix #4807 48h before closing a procedure, notify users their draft is not submitted 2020-03-24 16:46:23 -10:00
clemkeirua
e76870844e update test for dossier#en_construction_close_to_expiration
It now takes into account en_construction_conservation_extension
2020-03-24 18:10:51 +01:00
Paul Chavard
5c2eba1dd1 Always add a reason to dossier deletion 2020-03-24 09:30:11 +01:00
Paul Chavard
903cf0cef5 Keep operation logs after dossier removal 2020-03-24 09:18:45 +01:00
Paul Chavard
77018b9e2b Add expiration scopes to dossier 2020-03-18 15:25:02 +01:00
Paul Chavard
f35ccc9d92 Move process_expired_dossiers_brouillon to a service 2020-03-18 15:25:02 +01:00
Paul Chavard
c46e012c10 Use dossier.assign_to_groupe_instructeur 2020-03-03 10:30:49 +01:00
Christophe Robillard
2bd6f01009 log changer_groupe_instructeur 2020-02-26 11:25:07 +01:00
Christophe Robillard
e0f4957dfd notify instructeur after groupe_instructeur changed 2020-02-26 11:25:07 +01:00
Christophe Robillard
fb3d7e45ba unfollow stale instructeurs
when the group instructeur of a dossier is changed, unfollow the
instructeurs who don't belong to the new groupe instructeur
2020-02-26 11:25:07 +01:00
Paul Chavard
1ce1c1e6d0 use discard 2020-02-13 12:31:59 +01:00
Pierre de La Morinerie
96932faa3f models: add a Dossier#with_hidden scope, and remove unscoped usages 2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
4efea77280 specs: regroup dossier scope specs together 2020-01-28 17:32:38 +01:00
Pierre de La Morinerie
0efb62f03a factories: ensure that dossiers with_individual are consistent 2020-01-21 17:24:56 +01:00
Pierre de La Morinerie
724ff50363 factories: rename dossier for_individual to with_individual
This clarifies the distinction between

```
create :procedure, :for_individual
```

and

```
create :dossier, :with_individual
```
2020-01-21 17:24:56 +01:00
Paul Chavard
4edc7b00cf Use geocoder 2020-01-15 15:04:04 +01:00
Pierre de La Morinerie
5e05556ee8 dossiers: add a validation on dossier individual
Validate that a dossier on a `for_individual?` procedure always has
an `individual` associated record.

For this, the individual needs to be built before the record is
validated (i.e. even before the `before_create` callback is run).

This should help with #4596: now if a dossier is created without an
`individual`, or if the `invividual` record is later removed, the
validation will fail.
2020-01-08 10:48:22 +01:00
maatinito
a02a5edce3 Bug with time zone when testing sending of brouillon expiration notices 2019-12-11 17:34:10 +01:00
simon lehericey
006e426a11 Work on deletion mail 2019-12-03 17:18:53 +01:00
simon lehericey
79bfb8b143 Delete expired dossiers 2019-12-03 17:18:53 +01:00
simon lehericey
03b7e81ca4 Send deletion notice for near expired brouillon 2019-12-03 17:18:53 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
Nicolas Bouilleaud
03c950ea97 Move followed_dossiers_with_notifications to a Dossier scope
Instead of instructeur.followed_dossiers_with_notifications, we can now write instructeur.followed_dossiers.with_notifications.

Yay composition!
2019-09-25 14:10:00 +02:00
simon lehericey
9b16bd2037 Dossier: retrieve all dossiers for a procedure 2019-09-18 15:51:02 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
simon lehericey
3cc8f0c792 Link Dossier and GroupeInstructeur 2019-09-03 06:47:02 +02:00
simon lehericey
caf1fbca44 Use assign_to 2019-09-02 11:41:12 +02:00
simon lehericey
85499365a0 Instructeur has_many procedures through groupe_instructeur 2019-09-02 11:41:12 +02:00
simon lehericey
3fde2a6f70 Rename gestionnaire in code to instructeur 2019-08-12 13:47:01 +02:00
clemkeirua
d7105cb6f8 added spec for dossier#update_with_france_connect 2019-08-01 17:42:32 +02:00
Pierre de La Morinerie
ffe081c1f2 specs: remove old pieces_justificative from specs and factories 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
e975fe4ade tasks: remove task to migrate old pieces justificatives 2019-07-30 16:11:17 +02:00