Commit graph

261 commits

Author SHA1 Message Date
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
Pierre de La Morinerie
71dfb38787 emails: improve typography of titles 2019-07-17 15:01:19 +02:00
Pierre de La Morinerie
a8354bd103 dossiers: unify deletion of dossiers between manager and user
The code paths for deleting a dossier were different, depending on
whether the dossier was deleted by the user, or from the Manager.

This commit unifies the two code paths into one.

This has the effect of:

- An operation log is now recorded when an user deletes its own dossier;
- Gestionnaires are now notified even when the dossier is deleted from
  the Manager;
- The `support:delete_user_account` task now requires the email address
  of the author.
2019-07-16 16:22:20 +02:00
clemkeirua
25f81f1d3c download a dossier as zip with all attachments 2019-07-16 09:11:25 +02:00
Pierre de La Morinerie
35c3795f56 dossier: make messagerie available on archived procedures
An Admin may archive a procedure to make it unavailable to
the general public, but before all dossiers are handled. In this case,
the messagerie needs to be available.

Fix #4089
2019-07-11 15:37:04 +02:00
simon lehericey
7b63ddfabb Better champs factories 2019-07-10 16:41:34 +02:00
Pierre de La Morinerie
58a8d017f2 spec: cleanup dossier spec 2019-07-10 11:31:09 +02:00
Pierre de La Morinerie
56bc06cfbf dossier: fix flaky spec for nearing_end_of_retention
If the spec takes longer than 1s to run, the test would fail.
2019-07-10 11:00:49 +02:00
Paul Chavard
e582ff729c Add aasm to dossiers state 2019-07-03 13:37:27 +02:00