Commit graph

2560 commits

Author SHA1 Message Date
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
Pierre de La Morinerie
00e5b736fb factories: mark the parent procedure as for_individual
This ensures that we don't get an inconsistency, where a dossier is
`for_individual` while its procedure is not `for_individual`.
2020-01-21 17:24:56 +01:00
Pierre de La Morinerie
6a47458112 specs: use order-insentitive matching for arrays
The specs sometime failes locally, because the order of the returned
objects is undefined.

This is an acceptable behavior – but it means we should test for
collection membership, rather than for a specific array order.

Replace `match` by `match_array` to have unordered matching.
2020-01-21 17:24:56 +01:00
Christophe Robillard
675bbdad15 transfere les services lors de suppression admin
Lorsqu'un administrateur est supprimé, ses services sont transférés à un
autre administrateur pour chacune de ses procédures
2020-01-21 15:05:33 +01:00
Christophe Robillard
d9570eedc6 empêche suppression d'un user qui est instructeur 2020-01-21 15:05:33 +01:00
Christophe Robillard
a6d007dbd3 supprime un instructeur 2020-01-21 15:05:33 +01:00
Christophe Robillard
d4de5769ee empêche la suppression d'un user qui est admin 2020-01-21 15:05:33 +01:00
Christophe Robillard
d8a51f986f supprime un utilisateur qui a des dossiers cachés 2020-01-21 15:05:33 +01:00
clemkeirua
fb87a87f47 code review changes 2020-01-20 16:15:02 +01:00
clemkeirua
499f93aed3 ajout d'un test pour l'ecran de reaffectation des dossiers 2020-01-20 16:15:02 +01:00
clemkeirua
4e8ecb048c ajout d'un test pour la suppression des groupes 2020-01-20 16:15:02 +01:00
clemkeirua
d6e7799370 removed routing condition in weekly summary 2020-01-20 14:23:19 +01:00
clemkeirua
7e15c6a4a4 add filtering by group in procedure_overview
The weekly overview do not work for instructeurs in procedures with multiples groups ;
they see dossiers that they do not have access to. Now the correct filter is added
2020-01-20 14:23:19 +01:00
Paul Chavard
4edc7b00cf Use geocoder 2020-01-15 15:04:04 +01:00
Paul Chavard
14295db9ad Revert "Revert "Merge pull request #4552 from tchak/champ-communes""
This reverts commit 4373cb22cb.
2020-01-14 18:46:07 +01:00
clemkeirua
0c2ccb4ae0 added automated tests for PDF rendering
- as a user, it should not display the administration info
 - as an instructeur, it should display the administration info
 - it should render the proper view with no crash
2020-01-14 09:29:29 +01:00
clemkeirua
4373cb22cb Revert "Merge pull request #4552 from tchak/champ-communes"
This reverts commit 4cec26f73a, reversing
changes made to 0ef25ef36c.
2020-01-13 16:26:27 +01:00
Christophe Robillard
d289c21a8b speak english for test descriptions 2020-01-13 10:06:43 +01:00
Christophe Robillard
0f881f942b raise if trying to del a user who can't be deleted 2020-01-13 10:06:43 +01:00
Christophe Robillard
696a058280 delete adminis with procs managed by other admins 2020-01-13 10:06:43 +01:00
Christophe Robillard
a0b4d97d08 fix rubocop offenses 2020-01-13 10:06:43 +01:00
Christophe Robillard
9a62d3fe0c delete a user 2020-01-13 10:06:43 +01:00
Christophe Robillard
58ef36ff57 tells if a user can be deleted 2020-01-13 10:06:43 +01:00
Paul Chavard
c6326bfa77 Fix tests involving attachment urls 2020-01-08 14:46:18 +01:00
Pierre de La Morinerie
b3558c497d dossiers: make build_default_individual explicit
It avoid the use of callbacks, and may avoid situations where an empty
individual is implicitely created.
2020-01-08 10:48:22 +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
Pierre de La Morinerie
7f5b0d8bf3 specs: don't create an implicit brouillon in all test cases 2020-01-07 17:59:11 +01:00
Pierre de La Morinerie
630c6de967 specs: move the query for individual to the individual context 2020-01-07 17:59:11 +01:00
Paul Chavard
e61e39d345 Remove unused code and tests 2020-01-07 11:52:51 +01:00
Paul Chavard
ff46ee366e Fix user brouillon spec 2020-01-07 11:52:51 +01:00
Paul Chavard
4bbd16576b Add champ communes 2020-01-07 11:52:51 +01:00
Pierre de La Morinerie
8eb295d67e dossiers: avoid exceptions on invalid AASM transitions
When attempting an invalid transition on a dossier, provide a meaningful
error message (instead of letting an `AASM::InvalidTransition` exception
propagate).

This handles not only the case where the same state is applied twice
(which was already handled manually), but all cases where the transition
is invalid.
2019-12-19 13:25:32 +01:00
Pierre de La Morinerie
c7a307553c helpers: allow dossier_display_state to take a state as input
This allow to use either:

- `dossier_display_state(dossier)`
- `dossier_display_state(:en_construction)`
2019-12-19 13:22:40 +01:00
simon lehericey
60538c9c28 Controller use new export model 2019-12-18 13:13:15 +01:00
simon lehericey
745086cbb5 Simplify view 2019-12-18 13:13:15 +01:00
simon lehericey
d0939ae1a4 Add Export Model 2019-12-18 13:13:15 +01:00
simon lehericey
d0f0533a32 Remove unused code 2019-12-18 13:13:15 +01:00
simon lehericey
c02e8b9553 Routing: send emails to the right group 2019-12-16 17:47:08 +01:00
maatinito
a02a5edce3 Bug with time zone when testing sending of brouillon expiration notices 2019-12-11 17:34:10 +01:00
maatinito
9672d892e9 Bug with time zone: Time.zone.today looses time_zone and may breaks database comparisons 2019-12-11 17:34:10 +01:00
simon lehericey
058442c84e [link to #4557] An instructeur cannot change its email on its own 2019-12-11 17:18:21 +01:00
simon lehericey
e06733d01b Clean spec 2019-12-11 17:18:21 +01:00
Paul Chavard
6b5793f0b9 [GraphQL] fix a crash in mutations with an attachment 2019-12-11 13:22:32 +01:00
Paul Chavard
422b7f37ec [GraphQL] expose file information 2019-12-11 12:34:49 +01:00
Pierre de La Morinerie
c2882b6cc3 app: hide IE11 deprecation banner during the strike
Having two banners appearing in a few days may be overwhelming for
users.
2019-12-04 17:32:04 +01:00
Paul Chavard
2f060fc30a Add depubliee state to procedures 2019-12-04 16:52:41 +01:00
Paul Chavard
b5eafdab56 [GraphQL]: informations du service 2019-12-04 14:21:40 +01:00
Paul Chavard
fd42fafcb4 [GraphQL]: informations du demandeur du dossier 2019-12-04 12:39:29 +01:00
Christophe Robillard
4e7c779116 refuse les numéros de tel invalides
rend facultatif les numéros de téléphone
2019-12-04 05:34:43 +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
6391f7ff9c Work on notify_near_deletion mailer 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
Pierre de La Morinerie
3212dfddca app: allow hiding the browser banner for one week 2019-12-03 16:09:18 +01:00
Pierre de La Morinerie
fb3f82074d Hide the suggestions when the user corrects the address 2019-12-03 14:06:11 +01:00
Pierre de La Morinerie
1d1260060e Fix the tests by using event delegation 2019-12-03 14:06:11 +01:00
clemkeirua
849008231c ajout de test capybara 2019-12-03 14:06:11 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
Paul Chavard
3e334a3306 Drop test_started_at
# Conflicts:
#	spec/models/procedure_spec.rb
2019-11-28 14:17:47 +01:00
Pierre de La Morinerie
e7dd9e36d6 specs: fix Capybara warning
Capybara logs several warnings during tests:

> Locator Integer:243 for selector :link must be an instance of String
> or Symbol. This will raise an error in a future version of Capybara.

This is because we use selectors like `have_link(dossier.id)`, where the
locator is a Number (instead of a String or Symbol).
2019-11-28 12:09:12 +01:00
simon lehericey
6657459f9c Fix add instructeur with empty mail
As select2 does not handle required attribute, we can only add server side logic
2019-11-27 14:39:16 +01:00
Paul Chavard
e9f993fe0c [GraphQL]: normalize date names in French 2019-11-27 12:23:00 +01:00
Pierre de La Morinerie
a328e8d94a features: refactor the editor specs
- Add an `add_champ` helper
- Stop relying on a default champ being created
- Wait for all champs to be created by watching the "Add champ" button 

This should fix the flakiness of these tests.

Refs #4417
2019-11-27 11:58:46 +01:00
Pierre de La Morinerie
d0cd875e91 features: add a leave_browser_open helper 2019-11-27 11:58:45 +01:00
Pierre de La Morinerie
0ef4a5253c features: move feature matchers to their own file
This allows to have the same syntax than native Capybara matchers.
2019-11-27 11:58:45 +01:00
maatinito
9de9a1fd71 Use time.zone functions instead of server time functions
(Time.zone.today vs Date.today)
2019-11-26 14:26:36 +01:00
maatinito
14bc2b99b9 auto-archive badly occurs in UTC time and not in local time (1 hour too late in France, 10 hours before in Tahiti ;-) 2019-11-25 14:39:42 +01:00
clemkeirua
789fcf72ca ajout d'un test automatisé 2019-11-25 10:37:10 +01:00
Pierre de La Morinerie
1de4ef8a9a specs: fix error in routing feature test by waiting for Turbolinks 2019-11-21 18:37:51 +01:00
Pierre de La Morinerie
b78134c691 specs: make the routing feature test more robust
- Use human-readable form labels
- Always wait for the result of the previous action to be loaded before
  starting another action
2019-11-21 18:29:45 +01:00
Pierre de La Morinerie
68f5aae99d autosave: add feature test 2019-11-21 14:00:06 +01:00
Paul Chavard
0c6705f7fd Drop old export service 2019-11-21 10:25:40 +01:00
Christophe Robillard
b42f21264e permet le suivi auto après envoi instructeur
Close #4163
2019-11-20 16:41:30 +01:00
Pierre de La Morinerie
8b8a96abda dossiers: save draft by default (instead of submitting)
Make the default behavior of `update_brouillon` be to update the draft,
instead of submitting the dossier.

This makes all requests made to `update_brouillon` without specifying
an extra `submit_draft` parameter to just save the draft. It will make
autosaving the draft easier and safer.
2019-11-20 11:24:31 +01:00
simon lehericey
dae7a3bfd0 [fix #4529] Log user email in manager space 2019-11-19 12:15:03 +01:00
Paul Chavard
e600aceccc [GraphQL]: add dossier state change mutations 2019-11-19 11:51:34 +01:00
simon lehericey
4b62c9267a fix flaky test 2019-11-18 17:26:28 +01:00
simon lehericey
361e57355a Spec: full_scenario use js 2019-11-18 17:08:51 +01:00
simon lehericey
8a42b9f97a Add groupe instructeur mailer preview 2019-11-18 17:08:51 +01:00
simon lehericey
9ca026a630 Use a select2 box for looking to instructeurs 2019-11-18 17:08:51 +01:00
Paul Chavard
ba03dbf8dd [GraphQL] Add dossierEnvoyerMessage mutation 2019-11-13 19:54:27 +01:00
Paul Chavard
f0ac01bf19 [GraphQL]: test unauthorized mutation 2019-11-13 19:54:27 +01:00
Paul Chavard
ea6667ff9f [GraphQL]: démarche and dossier number should be a number 2019-11-13 15:53:56 +01:00
Paul Chavard
fa741c9bae [GraphQL]: do not return dossiers brouillons 2019-11-07 22:07:42 +01:00
Paul Chavard
990c867c2e [GraphQL] Add more filters to dossiers 2019-11-07 22:07:42 +01:00
Paul Chavard
f22b39b7c5 Handle non unique champ repetable labels
fix #4466
2019-11-07 14:27:52 +01:00
Paul Chavard
2a61ed5b1c Export etablissement information in csv
fix #4440
2019-11-07 14:27:52 +01:00
Paul Chavard
4231b81727 [GraphQL] Add create direct upload mutation 2019-11-07 12:48:51 +01:00
simon lehericey
9469734f29 Follow flipper name convention to appears on manager admin page 2019-11-07 11:09:05 +01:00
clemkeirua
7f76ab6671 disable retry sending a mail with an invalid email adress 2019-11-07 10:11:48 +01:00
Paul Chavard
0562e2728f Fix type_de_champ validation error 2019-11-06 12:54:07 +01:00
Pierre de La Morinerie
8df91df9fa assigns: strip and lowercase the search filter 2019-11-06 12:16:30 +01:00
Pierre de La Morinerie
0eeac59ecd assigns: fix search among the unassigned instructeurs
This was broken since moving the email out of the Instructeur column.
2019-11-06 12:16:30 +01:00
Paul Chavard
efd03f0169 Use webdrivers gem to keep webdrivers updated 2019-11-06 11:20:40 +01:00
simon lehericey
395aba8bbc Remove administrateur active notion 2019-11-05 14:10:39 +01:00
simon lehericey
5643e671a0 Code use user.active? 2019-11-05 14:10:39 +01:00
simon lehericey
b193dd1465 User get the active notion 2019-11-05 14:10:39 +01:00
simon lehericey
aeb44dd2aa Cleaning spec 2019-11-05 10:29:39 +01:00
simon lehericey
e3d7688e66 [fix #4473] Invite_administrateur!: do not reset password if the user is active 2019-11-05 10:29:39 +01:00