Commit graph

19 commits

Author SHA1 Message Date
Paul Chavard
8e1bfb469f fix(dossier): send expiration notifications 2 weeks prior to supression instead of a month 2021-08-26 11:28:57 +02:00
Paul Chavard
ffa8c0c80a feat(dossiers): enable dossiers termine expiration behind feature flag
feature flag "procedure_process_expired_dossiers_termine" controls if a procedure has expiration
enabled on dossiers termine

re #3796
2021-08-18 16:11:35 +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
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
Paul Chavard
4299c9dbea Use a “safe” reference date in expiration tests 2020-05-05 12:41:45 +02:00
Paul Chavard
31943f7d9c Add handeling of expired processed dossiers to deletion service 2020-04-22 15:39:10 +02:00
Paul Chavard
ca6c97bf0f Refactor expired dossiers deletion service 2020-04-02 15:24:02 +02:00
Paul Chavard
7ba4c513e6 Refactor notify near deletion mailers 2020-04-01 17:40:52 +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
c40d689edf Use bigger deltas to allow for month length variations 2020-03-31 11:50:59 +02:00
Paul Chavard
5b5ae5a7a5 Do not send notifications or create operation logs on brouillon demarches 2020-03-25 15:04:52 +01:00
Paul Chavard
5c2eba1dd1 Always add a reason to dossier deletion 2020-03-24 09:30:11 +01:00
Paul Chavard
cd0acb1344 Cleanup dossier mailers 2020-03-19 16:52:18 +01:00
simon lehericey
3dd4ea26c7 add similar tests for send_brouillon_expiration_notices and delete_expired_brouillon_and_notify 2020-03-18 15:25:02 +01:00
simon lehericey
3f6012bff5 Delete complicated test 2020-03-18 15:25:02 +01:00
simon lehericey
74db7ab146 test for #send_en_construction_expiration_notices 2020-03-18 15:25:02 +01:00
simon lehericey
f35c0518b7 test for #delete_expired_en_construction_and_notify 2020-03-18 15:25:02 +01:00
Paul Chavard
fe1cd2a47b Delete and notify en_construction dossiers 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