From 00218fded2ec407b28517f49c23b44ee9011df21 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Dec 2022 21:29:53 +0100 Subject: [PATCH] fix(dossier): update spec --- .../procedures_controller_spec.rb | 2 +- spec/fixtures/cassettes/api_geo_all.yml | 79 +++++++++++++++++++ spec/models/champ_spec.rb | 14 ++-- spec/system/accessibilite/wcag_usager_spec.rb | 2 +- spec/system/patron_spec.rb | 2 +- spec/system/users/brouillon_spec.rb | 23 ++++-- 6 files changed, 104 insertions(+), 18 deletions(-) create mode 100644 spec/fixtures/cassettes/api_geo_all.yml diff --git a/spec/controllers/administrateurs/procedures_controller_spec.rb b/spec/controllers/administrateurs/procedures_controller_spec.rb index fadbbcf1d..4e6554970 100644 --- a/spec/controllers/administrateurs/procedures_controller_spec.rb +++ b/spec/controllers/administrateurs/procedures_controller_spec.rb @@ -15,7 +15,7 @@ describe Administrateurs::ProceduresController, type: :controller do let(:zone_ids) { [zone.id] } let(:tags) { "[\"planete\",\"environnement\"]" } - describe '#apercu' do + describe '#apercu', vcr: { cassette_name: 'api_geo_all' } do render_views let(:procedure) { create(:procedure, :with_all_champs) } diff --git a/spec/fixtures/cassettes/api_geo_all.yml b/spec/fixtures/cassettes/api_geo_all.yml new file mode 100644 index 000000000..6ddbae52e --- /dev/null +++ b/spec/fixtures/cassettes/api_geo_all.yml @@ -0,0 +1,79 @@ +--- +http_interactions: +- request: + method: get + uri: https://geo.api.gouv.fr/departements + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.10.3 (Ubuntu) + Date: + - Tue, 20 Dec 2022 22:45:29 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '5083' + Vary: + - Accept-Encoding + - Origin + X-Powered-By: + - Express + Etag: + - W/"13db-vyFtsKQWjHylHAtBtjYjxCAjMHE" + Strict-Transport-Security: + - max-age=15552000 + body: + encoding: ASCII-8B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iLCJjb2RlIjoiOTUiLCJjb2RlUmVnaW9uIjoiMTEifSx7Im5vbSI6Ikd1YWRlbG91cGUiLCJjb2RlIjoiOTcxIiwiY29kZVJlZ2lvbiI6IjAxIn0seyJub20iOiJNYXJ0aW5pcXVlIiwiY29kZSI6Ijk3MiIsImNvZGVSZWdpb24iOiIwMiJ9LHsibm9tIjoiR3V5YW5lIiwiY29kZSI6Ijk3MyIsImNvZGVSZWdpb24iOiIwMyJ9LHsibm9tIjoiTGEgUsOpdW5pb24iLCJjb2RlIjoiOTc0IiwiY29kZVJlZ2lvbiI6IjA0In0seyJub20iOiJNYXlvdHRlIiwiY29kZSI6Ijk3NiIsImNvZGVSZWdpb24iOiIwNiJ9XQ== + recorded_at: Tue, 20 Dec 2022 22:45:29 GMT +- request: + method: get + uri: https://geo.api.gouv.fr/regions + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - demarches-simplifiees.fr + Expect: + - '' + response: + status: + code: 200 + message: '' + headers: + Server: + - nginx/1.10.3 (Ubuntu) + Date: + - Tue, 20 Dec 2022 22:45:29 GMT + Content-Type: + - application/json; charset=utf-8 + Content-Length: + - '653' + Vary: + - Accept-Encoding + - Origin + X-Powered-By: + - Express + Etag: + - W/"28d-NqjRJu+ph9X/ycpx3D2pjeoeVto" + Strict-Transport-Security: + - max-age=15552000 + body: + encoding: ASCII-8BIT + string: !binary |- + W3sibm9tIjoiw45sZS1kZS1GcmFuY2UiLCJjb2RlIjoiMTEifSx7Im5vbSI6IkNlbnRyZS1WYWwgZGUgTG9pcmUiLCJjb2RlIjoiMjQifSx7Im5vbSI6IkJvdXJnb2duZS1GcmFuY2hlLUNvbXTDqSIsImNvZGUiOiIyNyJ9LHsibm9tIjoiTm9ybWFuZGllIiwiY29kZSI6IjI4In0seyJub20iOiJIYXV0cy1kZS1GcmFuY2UiLCJjb2RlIjoiMzIifSx7Im5vbSI6IkdyYW5kIEVzdCIsImNvZGUiOiI0NCJ9LHsibm9tIjoiUGF5cyBkZSBsYSBMb2lyZSIsImNvZGUiOiI1MiJ9LHsibm9tIjoiQnJldGFnbmUiLCJjb2RlIjoiNTMifSx7Im5vbSI6Ik5vdXZlbGxlLUFxdWl0YWluZSIsImNvZGUiOiI3NSJ9LHsibm9tIjoiT2NjaXRhbmllIiwiY29kZSI6Ijc2In0seyJub20iOiJBdXZlcmduZS1SaMO0bmUtQWxwZXMiLCJjb2RlIjoiODQifSx7Im5vbSI6IlByb3ZlbmNlLUFscGVzLUPDtHRlIGQnQXp1ciIsImNvZGUiOiI5MyJ9LHsibm9tIjoiQ29yc2UiLCJjb2RlIjoiOTQifSx7Im5vbSI6Ikd1YWRlbG91cGUiLCJjb2RlIjoiMDEifSx7Im5vbSI6Ik1hcnRpbmlxdWUiLCJjb2RlIjoiMDIifSx7Im5vbSI6Ikd1eWFuZSIsImNvZGUiOiIwMyJ9LHsibm9tIjoiTGEgUsOpdW5pb24iLCJjb2RlIjoiMDQifSx7Im5vbSI6Ik1heW90dGUiLCJjb2RlIjoiMDYifV0= + recorded_at: Tue, 20 Dec 2022 22:45:29 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/models/champ_spec.rb b/spec/models/champ_spec.rb index 75e2d61a4..e26ffe746 100644 --- a/spec/models/champ_spec.rb +++ b/spec/models/champ_spec.rb @@ -196,7 +196,7 @@ describe Champ do end end - describe '#search_terms' do + describe '#search_terms', vcr: { cassette_name: 'api_geo_all' } do let(:champ) { type_de_champ.champ.build(value: value) } subject { champ.search_terms } @@ -247,9 +247,9 @@ describe Champ do context 'for département champ' do let(:type_de_champ) { build(:type_de_champ_departements) } - let(:value) { "69 - Rhône" } + let(:value) { "69" } - it { is_expected.to eq([value]) } + it { is_expected.to eq(['69 – Rhône']) } end context 'for dossier link champ' do @@ -319,9 +319,9 @@ describe Champ do context 'for pays champ' do let(:type_de_champ) { build(:type_de_champ_pays) } - let(:value) { "FRANCE" } + let(:value) { "FR" } - it { is_expected.to eq([value]) } + it { is_expected.to eq(['France']) } end context 'for phone champ' do @@ -340,9 +340,9 @@ describe Champ do context 'for region champ' do let(:type_de_champ) { build(:type_de_champ_regions) } - let(:value) { "Île-de-France" } + let(:value) { "11" } - it { is_expected.to eq([value]) } + it { is_expected.to eq(['Île-de-France']) } end context 'for siret champ' do diff --git a/spec/system/accessibilite/wcag_usager_spec.rb b/spec/system/accessibilite/wcag_usager_spec.rb index 90e935197..fdd1c9558 100644 --- a/spec/system/accessibilite/wcag_usager_spec.rb +++ b/spec/system/accessibilite/wcag_usager_spec.rb @@ -1,4 +1,4 @@ -describe 'wcag rules for usager', js: true do +describe 'wcag rules for usager', js: true, vcr: { cassette_name: 'api_geo_all' } do let(:procedure) { create(:procedure, :published, :with_all_champs, :with_service, :for_individual) } let(:password) { 'a very complicated password' } let(:litteraire_user) { create(:user, password: password) } diff --git a/spec/system/patron_spec.rb b/spec/system/patron_spec.rb index ba472ddfe..36ef9a573 100644 --- a/spec/system/patron_spec.rb +++ b/spec/system/patron_spec.rb @@ -1,4 +1,4 @@ -describe 'Accessing the /patron page:' do +describe 'Accessing the /patron page:', vcr: { cassette_name: 'api_geo_all' } do scenario 'I can display a page with all form fields and UI elements' do visit patron_path expect(page).to have_text('Icônes') diff --git a/spec/system/users/brouillon_spec.rb b/spec/system/users/brouillon_spec.rb index 9d810530a..cc9dc92a8 100644 --- a/spec/system/users/brouillon_spec.rb +++ b/spec/system/users/brouillon_spec.rb @@ -6,7 +6,14 @@ describe 'The user' do let(:user_dossier) { user.dossiers.first } let!(:dossier_to_link) { create(:dossier) } - scenario 'fill a dossier', js: true do + let(:memory_store) { ActiveSupport::Cache.lookup_store(:memory_store) } + + before do + allow(Rails).to receive(:cache).and_return(memory_store) + Rails.cache.clear + end + + scenario 'fill a dossier', js: true, vcr: { cassette_name: 'api_geo_all' } do log_in(user, procedure) fill_individual @@ -33,9 +40,9 @@ describe 'The user' do select_combobox('multiple_choice_drop_down_list_long', 'alp', 'alpha') select_combobox('multiple_choice_drop_down_list_long', 'cha', 'charly') - select_combobox('pays', 'aust', 'Australie') - select_combobox('regions', 'Ma', 'Martinique') - select_combobox('departements', 'Ai', '02 - Aisne') + select('Australie', from: form_id_for('pays')) + select('Martinique', from: form_id_for('regions')) + select('02 – Aisne', from: form_id_for('departements')) select_combobox('communes', 'Ai', '02 - Aisne', check: false) select_combobox('communes', 'Ambl', 'Ambléon (01300)') @@ -65,7 +72,7 @@ describe 'The user' do expect(JSON.parse(champ_value_for('multiple_drop_down_list'))).to match(['val1', 'val3']) expect(champ_value_for('pays')).to eq('Australie') expect(champ_value_for('regions')).to eq('Martinique') - expect(champ_value_for('departements')).to eq('02 - Aisne') + expect(champ_value_for('departements')).to eq('Aisne') expect(champ_value_for('communes')).to eq('Ambléon (01300)') expect(champ_value_for('dossier_link')).to eq('123') expect(champ_value_for('piece_justificative')).to be_nil # antivirus hasn't approved the file yet @@ -86,10 +93,10 @@ describe 'The user' do expect(page).to have_checked_field('val1') expect(page).to have_checked_field('val3') expect(page).to have_selected_value('simple_choice_drop_down_list_long', selected: 'bravo') + expect(page).to have_selected_value('pays', selected: 'Australie') + expect(page).to have_selected_value('regions', selected: 'Martinique') + expect(page).to have_selected_value('departements', selected: '02 – Aisne') check_selected_value('multiple_choice_drop_down_list_long', with: ['alpha', 'charly']) - check_selected_value('pays', with: 'Australie') - check_selected_value('regions', with: 'Martinique') - check_selected_value('departements', with: '02 - Aisne') check_selected_value('communes', with: 'Ambléon (01300)') expect(page).to have_field('dossier_link', with: '123') expect(page).to have_text('file.pdf')