Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e156f05
Migrate CARIF-OREF specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
0fe9c23
Migrate INSEE Authenticate spec off VCR to WebMock stub
Samuelfaure Sep 1, 2026
186ea76
Migrate INSEE Métadonnées and Commune Insee Code specs off VCR
Samuelfaure Sep 1, 2026
c487a87
Migrate INSEE Établissement and Adresse Etablissement specs off VCR
Samuelfaure Sep 1, 2026
6b24265
Fix redirected_siret helper shadowing in INSEE make_request spec
Samuelfaure Sep 1, 2026
15a006b
Migrate INSEE Siège Unité Légale specs off VCR
Samuelfaure Sep 1, 2026
7459d70
Migrate INSEE Unité Légale specs off VCR
Samuelfaure Sep 1, 2026
64e813b
Use inline rubocop:disable for insee.rb ModuleLength, not YAML exclusion
Samuelfaure Sep 1, 2026
88e537c
Migrate Probtp specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
e7c36f4
Migrate INPI RNE and proxy controller specs off VCR
Samuelfaure Sep 1, 2026
2f0065b
Migrate Qualibat specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
66e7134
Move Qualibat PDF fixture to fixtures/pdfs and document why it must s…
Samuelfaure Sep 1, 2026
58dbc12
Migrate Infogreffe specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
673420a
Migrate Fabrique Numérique des Ministères Sociaux specs off VCR
Samuelfaure Sep 1, 2026
27c0d24
Migrate RNM entreprises artisanales specs off VCR
Samuelfaure Sep 1, 2026
28faacf
Migrate OPQIBI specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
c34ca30
Migrate MI associations and DJEPVA specs off VCR
Samuelfaure Sep 1, 2026
ab4dc30
Migrate France Travail (Pôle Emploi) specs off VCR
Samuelfaure Sep 1, 2026
9e522a3
Migrate DGDDI EORI specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
1636a27
Remove dead DGDDI invalid-eori-format stub
Samuelfaure Sep 1, 2026
923aa50
Migrate ADEME certificats RGE specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
cfe7db5
Migrate ACOSS and URSSAF attestations sociales specs off VCR
Samuelfaure Sep 1, 2026
b9a0bd0
Migrate MEN scolarités specs off VCR
Samuelfaure Sep 1, 2026
ae93e7a
Migrate FNTP carte professionnelle specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
59d0e13
Migrate CNETP attestation specs off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
f5c5a1a
Migrate Banque de France bilans entreprise specs off VCR
Samuelfaure Sep 1, 2026
110da62
Migrate GIP MDS Authenticate spec off VCR to WebMock stub
Samuelfaure Sep 1, 2026
32250d0
Migrate CIBTP request spec off VCR to WebMock stubs
Samuelfaure Sep 1, 2026
2147e01
Remove VCR gem and its supporting test infrastructure
Samuelfaure Sep 1, 2026
90c4129
Remove 3 residual VCR references missed in the initial cleanup
Samuelfaure Sep 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions siade/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ Rails/Inquiry:
RSpec/NestedGroups:
Enabled: false

RSpec/Output:
Exclude:
- "spec/vcr_helper.rb"

RSpec/ScatteredSetup:
Exclude:
- "spec/requests/api/v3_and_more/**/*_spec.rb"
Expand Down
3 changes: 1 addition & 2 deletions siade/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- Run all tests: `bundle exec rspec`
- Run single test: `bundle exec rspec path/to/file_spec.rb:line_number`
- Run tests with coverage: `COVERAGE=true rspec`
- Debug VCR cassettes or WebMock stubbing issues: `DEBUG_VCR=true rspec`
- Generate OpenAPI docs: `bin/generate_swagger.sh`
- Run Rubocop: `bundle exec rubocop`
- Auto-fix Rubocop issues: `bundle exec rubocop -A`
Expand All @@ -21,7 +20,7 @@
- Naming: Snake_case for methods/variables, CamelCase for classes
- Error handling: Create specific error classes in app/errors/ and use the config/errors.yml configuration
- API responses: Follow REST/JSON:API format with data/links/meta structure
- Tests: RSpec with manually stubbed requests using WebMock. VCR is legacy - do NOT use VCR for new implementations, always use manual stubs
- Tests: RSpec with manually stubbed requests using WebMock (see `spec/support/provider_stubs/`)
- Model specs: Do NOT test ActiveRecord associations (belongs_to, has_many, etc.) — that's testing the framework. Only test custom behavior (scopes, methods, validations). Ensure factories are valid instead.
- Interactors: Use organizers pattern with small, focused interactors
- APIs: Use the scaffold_resource generator for new APIs
Expand Down
1 change: 0 additions & 1 deletion siade/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ group :test do

gem 'json-schema'
gem 'timecop'
gem 'vcr'
gem 'webmock', '~> 3.26'

gem 'ammeter'
Expand Down
2 changes: 0 additions & 2 deletions siade/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ GEM
utf8-cleaner (2.0.1)
activesupport
rack (~> 3.0)
vcr (6.4.0)
version_gem (1.1.14)
webmock (3.26.3)
addressable (>= 2.8.0)
Expand Down Expand Up @@ -577,7 +576,6 @@ DEPENDENCIES
unindent
uri (= 1.1.1)
utf8-cleaner
vcr
webmock (~> 3.26)
xml-simple

Expand Down
11 changes: 2 additions & 9 deletions siade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ Avec le coverage:
COVERAGE=true rspec
```

Si vous rencontrez des problèmes de matching sur les cassettes VCR, vous pouvez
obtenir plus de logs de la manière suivante:

```sh
DEBUG_VCR=true rspec
```

### Avertissements sur les cas de tests

Il n'est pas possible de mettre de données personnelles dans les tests, soit le
fournisseur de données a un environnement de test soit il faut utiliser webmock
et non VCR.
fournisseur de données a un environnement de test soit il faut stubber les
requêtes avec webmock (voir `spec/support/provider_stubs/`).

## Code Coverage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ automatiquement selon le suffixe de la clé :
- Toutes les autres clés → `test_<nom_cle>`

Les clés nécessitant une valeur spécifique (clés RSA, chemins SSL, valeurs
correspondant aux cassettes VCR, etc.) sont définies dans
attendues par les stubs webmock, etc.) sont définies dans
`spec/support/helpers/test_credentials_setup.rb`.

### Ajouter une nouvelle clé de credential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
its(:parsed_body) { is_expected.to have_json_api_format_errors }
end

describe 'when RNE renders valid response', vcr: { cassette_name: 'inpi/rne/actes_download/valid' } do
describe 'when RNE renders valid response' do
before do
stub_inpi_rne_authenticate
stub_inpi_rne_download_valid(target:, document_id:)
end

it { is_expected.to have_http_status(:ok) }

it 'returns the document_url' do
Expand All @@ -57,7 +62,7 @@
its(:parsed_body) { is_expected.to have_json_error(detail: 'Le lien de téléchargement est expiré.') }
end

describe 'when it is a bilan', vcr: { cassette_name: 'inpi/rne/bilans_download/valid' } do
describe 'when it is a bilan' do
let(:target) { 'bilans' }

it { is_expected.to have_http_status(:ok) }
Expand All @@ -68,8 +73,9 @@
end
end

describe 'when rne renders a 404', vcr: { cassette_name: 'inpi/rne/authenticate' } do
describe 'when rne renders a 404' do
before do
stub_inpi_rne_authenticate
stub_inpi_rne_download_not_found(target:, document_id:)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
let(:token) { TokenFactory.new(scopes).valid }
let(:identifiant) { 'whatever' }

describe 'with valid params', vcr: { cassette_name: 'france_travail/oauth2' } do
describe 'with valid params' do
before do
stub_france_travail_authenticate

stub_request(:post, Siade.credentials[:france_travail_status_url]).and_return(
status: 200,
body: read_payload_file('france_travail/statut/valid.json')
Expand Down Expand Up @@ -56,10 +58,12 @@
end
end

describe 'when it is a 404', vcr: { cassette_name: 'france_travail/oauth2' } do
describe 'when it is a 404' do
let(:scopes) { all_france_travail_scopes }

before do
stub_france_travail_authenticate

stub_request(:post, Siade.credentials[:france_travail_status_url]).and_return(
status: 404,
body: read_payload_file('france_travail/statut/not_found.json')
Expand Down
10 changes: 10 additions & 0 deletions siade/spec/controllers/mcp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@
context 'when mcp is enabled on token' do
let(:token) { TokenFactory.new(%w[mcp_scope1]).valid(mcp: true) }

let(:interactor_context) do
interactor_context = Interactor::Context.new
interactor_context.bundled_data = BundledData.new(data: { siren: '130025265' })
interactor_context
end

before do
allow(INSEE::UniteLegale).to receive(:call).and_return(interactor_context)
end

it {
subject
expect(response).to have_http_status(:ok)
Expand Down
66 changes: 0 additions & 66 deletions siade/spec/fixtures/cassettes/acoss/oauth2.yml

This file was deleted.

125 changes: 0 additions & 125 deletions siade/spec/fixtures/cassettes/acoss/with_non_existent_siren.yml

This file was deleted.

Loading
Loading