diff --git a/.rubocop.yml b/.rubocop.yml index 9a19249af..78b587ff4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,7 +18,7 @@ Layout/AlignParameters: EnforcedStyle: with_fixed_indentation Layout/BlockEndNewline: - Enabled: false + Enabled: true Layout/CaseIndentation: Enabled: false diff --git a/app/services/module_api_carto_service.rb b/app/services/module_api_carto_service.rb index 4838d13b1..d32307e87 100644 --- a/app/services/module_api_carto_service.rb +++ b/app/services/module_api_carto_service.rb @@ -26,12 +26,14 @@ class ModuleApiCartoService def self.generate_qp coordinates coordinates.inject({}) { |acc, coordinate| acc.merge CARTO::SGMAP::QuartiersPrioritaires::Adapter.new( - coordinate.map { |element| [element['lng'], element['lat']] }).to_params } + coordinate.map { |element| [element['lng'], element['lat']] }).to_params + } end def self.generate_cadastre coordinates (coordinates.inject([]) { |acc, coordinate| acc << CARTO::SGMAP::Cadastre::Adapter.new( - coordinate.map { |element| [element['lng'], element['lat']] }).to_params }).flatten + coordinate.map { |element| [element['lng'], element['lat']] }).to_params + }).flatten end end diff --git a/spec/controllers/api/v1/dossiers_controller_spec.rb b/spec/controllers/api/v1/dossiers_controller_spec.rb index be00999ee..bcbf27315 100644 --- a/spec/controllers/api/v1/dossiers_controller_spec.rb +++ b/spec/controllers/api/v1/dossiers_controller_spec.rb @@ -144,7 +144,8 @@ describe API::V1::DossiersController do :code_effectif_entreprise, :date_creation, :nom, - :prenom] } + :prenom] + } subject { super()[:entreprise] } it { expect(subject[:siren]).to eq('440117620') } @@ -164,7 +165,8 @@ describe API::V1::DossiersController do let(:field_list) { [ :id, :libelle, - :description] } + :description] + } subject { super()[:types_de_piece_justificative] } it { expect(subject.length).to eq 2 } @@ -184,9 +186,9 @@ describe API::V1::DossiersController do end let(:field_list) { [ - :url, :created_at, :type_de_piece_justificative_id] } - subject { - super()[:pieces_justificatives].first } + :url, :created_at, :type_de_piece_justificative_id] + } + subject { super()[:pieces_justificatives].first } it { expect(subject.keys.include?(:content_url)).to be_truthy } it { expect(subject[:created_at]).not_to be_nil } @@ -203,7 +205,8 @@ describe API::V1::DossiersController do describe 'champs' do let(:field_list) { [ - :url] } + :url] + } subject { super()[:champs] } it { expect(subject.length).to eq 1 } @@ -220,7 +223,8 @@ describe API::V1::DossiersController do :libelle, :description, :order_place, - :type] } + :type] + } subject { super()[:type_de_champ] } it { expect(subject.keys.include?(:id)).to be_truthy } @@ -234,7 +238,8 @@ describe API::V1::DossiersController do describe 'champs_private' do let(:field_list) { [ - :url] } + :url] + } subject { super()[:champs_private] } it { expect(subject.length).to eq 1 } @@ -251,7 +256,8 @@ describe API::V1::DossiersController do :libelle, :description, :order_place, - :type] } + :type] + } subject { super()[:type_de_champ] } it { expect(subject.keys.include?(:id)).to be_truthy } @@ -298,9 +304,9 @@ describe API::V1::DossiersController do describe 'user' do let(:field_list) { [ - :url, :created_at, :type_de_piece_justificative_id] } - subject { - super()[:user] } + :url, :created_at, :type_de_piece_justificative_id] + } + subject { super()[:user] } it { expect(subject[:email]).not_to be_nil } end @@ -320,7 +326,8 @@ describe API::V1::DossiersController do :code_postal, :localite, :code_insee_localite - ] } + ] + } subject { super()[:etablissement] } it { expect(subject[:siret]).to eq('44011762001530') } diff --git a/spec/controllers/stats_controller_spec.rb b/spec/controllers/stats_controller_spec.rb index d574fde07..238af0f66 100644 --- a/spec/controllers/stats_controller_spec.rb +++ b/spec/controllers/stats_controller_spec.rb @@ -17,7 +17,8 @@ describe StatsController, type: :controller do it { expect(subject).to eq([ [I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1], [I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 2] - ] ) } + ]) + } end context "with a date attribute" do @@ -35,7 +36,8 @@ describe StatsController, type: :controller do it { expect(subject).to eq([ [I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 2], [I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 1] - ] ) } + ]) + } end end @@ -52,9 +54,10 @@ describe StatsController, type: :controller do subject { StatsController.new.send(:cumulative_hash, association) } it { expect(subject).to eq({ - 45.days.ago.beginning_of_month => 1, - 15.days.ago.beginning_of_month => 3 - }) } + 45.days.ago.beginning_of_month => 1, + 15.days.ago.beginning_of_month => 3 + }) + } end context "with a date attribute" do @@ -69,9 +72,10 @@ describe StatsController, type: :controller do subject { StatsController.new.send(:cumulative_hash, association, :updated_at) } it { expect(subject).to eq({ - 20.days.ago.beginning_of_month => 2, - 10.days.ago.beginning_of_month => 3 - }) } + 20.days.ago.beginning_of_month => 2, + 10.days.ago.beginning_of_month => 3 + }) + } end end diff --git a/spec/controllers/users/description_controller_shared_example.rb b/spec/controllers/users/description_controller_shared_example.rb index f74eb29b1..9a73c5735 100644 --- a/spec/controllers/users/description_controller_shared_example.rb +++ b/spec/controllers/users/description_controller_shared_example.rb @@ -161,7 +161,8 @@ shared_examples 'description_controller_spec' do context 'Quand la procédure accepte les CERFA' do subject { post :update, params: {dossier_id: dossier_id, - cerfa_pdf: cerfa_pdf} } + cerfa_pdf: cerfa_pdf} + } it 'Notification interne is create' do expect { subject }.to change(Notification, :count).by (1) @@ -319,7 +320,8 @@ shared_examples 'description_controller_spec' do subject { patch :pieces_justificatives, params: {dossier_id: dossier.id, 'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0, - 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} } + 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} + } context 'when user is a guest' do let(:guest) { create :user } @@ -394,7 +396,8 @@ shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner subject { patch :pieces_justificatives, params: {dossier_id: dossier.id, 'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0, - 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} } + 'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} + } context 'when user is the owner', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do before do diff --git a/spec/facades/dossiers_list_facades_spec.rb b/spec/facades/dossiers_list_facades_spec.rb index f8ed7e2fa..0a9c7a0d3 100644 --- a/spec/facades/dossiers_list_facades_spec.rb +++ b/spec/facades/dossiers_list_facades_spec.rb @@ -10,14 +10,16 @@ describe DossiersListFacades do gestionnaire: gestionnaire, table: nil, attr: 'state', - attr_decorate: 'display_state' } + attr_decorate: 'display_state' + } let!(:preference_2) { create :preference_list_dossier, gestionnaire: gestionnaire, table: 'champs', attr: 'state', attr_decorate: 'display_state', - procedure_id: procedure.id } + procedure_id: procedure.id + } before do create :assign_to, procedure: procedure, gestionnaire: gestionnaire @@ -63,7 +65,8 @@ describe DossiersListFacades do attr: 'state', attr_decorate: 'display_state', filter: filter, - procedure_id: procedure_id } + procedure_id: procedure_id + } subject { facade.active_filter? preference } diff --git a/spec/features/france_connect/france_connect_particulier_spec.rb b/spec/features/france_connect/france_connect_particulier_spec.rb index 2ba15e71b..781e35b6c 100644 --- a/spec/features/france_connect/france_connect_particulier_spec.rb +++ b/spec/features/france_connect/france_connect_particulier_spec.rb @@ -17,7 +17,8 @@ feature 'France Connect Particulier Connexion' do birthdate: birthdate, birthplace: birthplace, gender: gender, - email: email) } + email: email) + } context 'when user is on login page' do @@ -40,7 +41,8 @@ feature 'France Connect Particulier Connexion' do birthdate: birthdate, birthplace: birthplace, gender: gender, - email_france_connect: email) } + email_france_connect: email) + } before do allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code)) diff --git a/spec/lib/carto/sgmap/cadastre/adapter_spec.rb b/spec/lib/carto/sgmap/cadastre/adapter_spec.rb index 134675d3a..e6912c1cb 100644 --- a/spec/lib/carto/sgmap/cadastre/adapter_spec.rb +++ b/spec/lib/carto/sgmap/cadastre/adapter_spec.rb @@ -31,7 +31,8 @@ describe CARTO::SGMAP::Cadastre::Adapter do :code_dep, :nom_com, :code_com, - :code_arr] } + :code_arr] + } end describe 'Attributes' do diff --git a/spec/models/drop_down_list_spec.rb b/spec/models/drop_down_list_spec.rb index 0455985fc..b065dace9 100644 --- a/spec/models/drop_down_list_spec.rb +++ b/spec/models/drop_down_list_spec.rb @@ -17,7 +17,8 @@ describe DropDownList do Dév.Eco / Emploi Cadre de vie / Urb. Pilotage / Ingénierie -" } +" +} it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Dév.Eco / Emploi', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] } @@ -26,7 +27,8 @@ Pilotage / Ingénierie Cadre de vie / Urb. Pilotage / Ingénierie -" } +" +} it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] } end @@ -36,7 +38,8 @@ Pilotage / Ingénierie let(:value) { "tip --top-- --troupt-- -ouaich" } +ouaich" +} it { expect(dropdownlist.disabled_options).to match(['--top--', '--troupt--']) } end diff --git a/spec/models/gestionnaire_spec.rb b/spec/models/gestionnaire_spec.rb index fbfbfd76f..8b85128d4 100644 --- a/spec/models/gestionnaire_spec.rb +++ b/spec/models/gestionnaire_spec.rb @@ -204,7 +204,8 @@ describe Gestionnaire, type: :model do it { is_expected.to eq 0 } it { expect(gestionnaire.follows.count).to eq 0 } it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject) - subject } + subject + } end context 'when gestionnaire follow any dossier into the procedure past in params' do @@ -215,7 +216,8 @@ describe Gestionnaire, type: :model do it { is_expected.to eq 0 } it { expect(gestionnaire.follows.count).to eq 1 } it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject) - subject } + subject + } end context 'when gestionnaire follow a dossier with a notification into the procedure past in params' do @@ -229,7 +231,8 @@ describe Gestionnaire, type: :model do it { is_expected.to eq 1 } it { expect(gestionnaire.follows.count).to eq 1 } it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).to receive(:inject) - subject } + subject + } end end diff --git a/spec/services/dossiers_list_gestionnaire_service_spec.rb b/spec/services/dossiers_list_gestionnaire_service_spec.rb index f1ca2b6e2..de32a0aa9 100644 --- a/spec/services/dossiers_list_gestionnaire_service_spec.rb +++ b/spec/services/dossiers_list_gestionnaire_service_spec.rb @@ -49,7 +49,8 @@ describe DossiersListGestionnaireService do let(:order) { 'desc' } let(:select_preference_list_dossier) { gestionnaire.preference_list_dossiers - .find_by(table: table, attr: attr, procedure: nil) } + .find_by(table: table, attr: attr, procedure: nil) + } subject { DossiersListGestionnaireService.new(gestionnaire, liste).change_sort! param_sort } @@ -99,7 +100,8 @@ describe DossiersListGestionnaireService do let(:filter_value) { 'plop' } let(:select_preference_list_dossier) { gestionnaire.preference_list_dossiers - .find_by(table: table, attr: attr, procedure: nil) } + .find_by(table: table, attr: attr, procedure: nil) + } subject { described_class.new(gestionnaire, liste).add_filter new_filter } diff --git a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb index d0bcacd86..410d63c74 100644 --- a/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb +++ b/spec/views/users/description/_pieces_justificatives.html.haml_spec.rb @@ -2,20 +2,24 @@ require 'spec_helper' describe 'users/description/_pieces_justificatives.html.haml', type: :view do let!(:procedure) { create(:procedure) } - let!(:tpj1) { create(:type_de_piece_justificative, - procedure: procedure, - libelle: "Première pièce jointe", - description: "Première description", - order_place: 1, - mandatory: true - )} - let!(:tpj2) { create(:type_de_piece_justificative, - procedure: procedure, - libelle: "Seconde pièce jointe", - description: "Seconde description", - order_place: 2, - lien_demarche: "https://www.google.fr" - )} + let!(:tpj1) { + create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Première pièce jointe", + description: "Première description", + order_place: 1, + mandatory: true + ) + } + let!(:tpj2) { + create(:type_de_piece_justificative, + procedure: procedure, + libelle: "Seconde pièce jointe", + description: "Seconde description", + order_place: 2, + lien_demarche: "https://www.google.fr" + ) + } let!(:dossier) { create(:dossier, :procedure => procedure) } before do