Commit graph

15 commits

Author SHA1 Message Date
Pierre de La Morinerie
5908b8019a specs: properly use xhr: true in javascript requests
This avoids an unexpected `ActionController::InvalidCrossOriginRequest`
exception to be raised when the forgery protection is disabled.
2021-06-22 13:21:55 +02:00
Pierre de La Morinerie
150ddab660 zeitwerk: Api -> API 2021-02-09 13:07:30 +01:00
Judith
6d89a83d14 unused locales clean-up 2021-02-04 12:15:13 +01:00
kara Diaby
f748ccfc9e Appelle l'API entreprise avec le token en Header 2020-12-10 17:49:49 +01:00
Pierre de La Morinerie
6328011f60 models: require belong_to associations on champ
- Make `champ.dossier` a requirement;
- Move the dossier_id assignation to `before_validation` (otherwise
the record is invalid, and never gets saved);
- Allow specs to only build the champ (instead of saving it to the
database), which bypasses the requirement to have a dossier.
2020-08-18 15:57:37 +02:00
Christophe Robillard
fb87a09c02 doesn't update dossier etablissement for siret controller 2020-05-26 18:13:20 +02:00
Christophe Robillard
637bde7326 update siret_controller when finding etablissement
now, `ApiEntrepriseService` does'nt return a hash anymore but an
etablissement which is already persisted.
2020-05-20 11:09:54 +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
c281347da1 Remove restclient 2020-03-17 11:12:14 +01:00
Pierre de La Morinerie
e06e32238c api_entreprise: display a specific error message on network errors 2019-05-02 11:24:38 +02:00
Pierre de La Morinerie
7c1c61248e spec: cleanup siret_controller_spec.rb 2019-05-02 11:24:22 +02:00
simon lehericey
f945b9ec63 Champ Siret: Fix siret-champ save
When a user enter a siret, it calls siret_controller in ajax. The champ value is stil nil, so champ.present? is false because champ.blank is redefined to focus on value. Thus the champ is not updated.
2019-04-02 14:17:21 +02:00
Paul Chavard
69a51e3296 Save SIRET data on search 2019-03-19 16:22:42 +01:00
gregoirenovel
ed240cb4d3 Enable Style/UnneededInterpolation 2018-10-03 12:03:21 +02:00
Paul Chavard
55a9b31b93 Cleanup SIRET champ 2018-09-12 15:53:02 +02:00