Enable the Layout/FirstHashElementLineBreak cop

This commit is contained in:
gregoirenovel 2018-01-15 15:34:26 +01:00
parent 08ed400ec2
commit 9f855afdfe
10 changed files with 135 additions and 100 deletions

View file

@ -86,7 +86,7 @@ Layout/FirstArrayElementLineBreak:
Enabled: true Enabled: true
Layout/FirstHashElementLineBreak: Layout/FirstHashElementLineBreak:
Enabled: false Enabled: true
Layout/FirstMethodArgumentLineBreak: Layout/FirstMethodArgumentLineBreak:
Enabled: false Enabled: false

View file

@ -29,20 +29,28 @@ module TagsSubstitutionConcern
def dossier_tags def dossier_tags
[ [
{ libelle: 'motivation', {
libelle: 'motivation',
description: 'Motivation facultative associée à la décision finale dacceptation, refus ou classement sans suite', description: 'Motivation facultative associée à la décision finale dacceptation, refus ou classement sans suite',
target: :motivation, target: :motivation,
dossier_termine_only: true }, dossier_termine_only: true
{ libelle: 'date de dépôt', },
{
libelle: 'date de dépôt',
description: 'Date du passage en construction du dossier par lusager', description: 'Date du passage en construction du dossier par lusager',
lambda: -> (d) { format_date(d.en_construction_at) } }, lambda: -> (d) { format_date(d.en_construction_at) }
{ libelle: 'date de passage en instruction', },
{
libelle: 'date de passage en instruction',
description: '', description: '',
lambda: -> (d) { format_date(d.en_instruction_at) } }, lambda: -> (d) { format_date(d.en_instruction_at) }
{ libelle: 'date de décision', },
{
libelle: 'date de décision',
description: 'Date de la décision dacceptation, refus, ou classement sans suite', description: 'Date de la décision dacceptation, refus, ou classement sans suite',
lambda: -> (d) { format_date(d.processed_at) }, lambda: -> (d) { format_date(d.processed_at) },
dossier_termine_only: true }, dossier_termine_only: true
},
{ libelle: 'libellé procédure', description: '', lambda: -> (d) { d.procedure.libelle } }, { libelle: 'libellé procédure', description: '', lambda: -> (d) { d.procedure.libelle } },
{ libelle: 'numéro du dossier', description: '', target: :id } { libelle: 'numéro du dossier', description: '', target: :id }
] ]

View file

@ -18,13 +18,15 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
add_reference :france_connect_informations, :user, references: :users add_reference :france_connect_informations, :user, references: :users
User.all.each do |user| User.all.each do |user|
FranceConnectInformation.create({gender: user.gender, FranceConnectInformation.create({
given_name: user.given_name, gender: user.gender,
family_name: user.family_name, given_name: user.given_name,
birthdate: user.birthdate, family_name: user.family_name,
birthplace: user.birthplace, birthdate: user.birthdate,
france_connect_particulier_id: user.france_connect_particulier_id, birthplace: user.birthplace,
user_id: user.id}) if user.france_connect_particulier_id.present? france_connect_particulier_id: user.france_connect_particulier_id,
user_id: user.id
}) if user.france_connect_particulier_id.present?
end end
remove_column :users, :gender remove_column :users, :gender
@ -44,12 +46,14 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
add_column :users, :france_connect_particulier_id, :string add_column :users, :france_connect_particulier_id, :string
FranceConnectInformation.all.each do |fci| FranceConnectInformation.all.each do |fci|
User.find(fci.user_id).update_attributes({gender: fci.gender, User.find(fci.user_id).update_attributes({
given_name: fci.given_name, gender: fci.gender,
family_name: fci.family_name, given_name: fci.given_name,
birthdate: fci.birthdate, family_name: fci.family_name,
birthplace: fci.birthplace, birthdate: fci.birthdate,
france_connect_particulier_id: fci.france_connect_particulier_id}) birthplace: fci.birthplace,
france_connect_particulier_id: fci.france_connect_particulier_id
})
end end
drop_table :france_connect_informations drop_table :france_connect_informations

View file

@ -19,8 +19,10 @@ describe Admin::AttestationTemplatesController, type: :controller do
before do before do
post :preview, post :preview,
params: { procedure_id: procedure.id, params: {
attestation_template: upload_params } procedure_id: procedure.id,
attestation_template: upload_params
}
end end
context 'with an interlaced png' do context 'with an interlaced png' do
@ -73,8 +75,10 @@ describe Admin::AttestationTemplatesController, type: :controller do
context 'nominal' do context 'nominal' do
before do before do
post :create, post :create,
params: { procedure_id: procedure.id, params: {
attestation_template: attestation_params.merge(logo: logo, signature: signature) } procedure_id: procedure.id,
attestation_template: attestation_params.merge(logo: logo, signature: signature)
}
procedure.reload procedure.reload
end end
@ -96,8 +100,10 @@ describe Admin::AttestationTemplatesController, type: :controller do
.and_return(double(full_messages: ['nop'])) .and_return(double(full_messages: ['nop']))
post :create, post :create,
params: { procedure_id: procedure.id, params: {
attestation_template: attestation_params } procedure_id: procedure.id,
attestation_template: attestation_params
}
procedure.reload procedure.reload
end end
@ -113,8 +119,10 @@ describe Admin::AttestationTemplatesController, type: :controller do
context 'nominal' do context 'nominal' do
before do before do
patch :update, patch :update,
params: { procedure_id: procedure.id, params: {
attestation_template: attestation_params_with_images } procedure_id: procedure.id,
attestation_template: attestation_params_with_images
}
procedure.reload procedure.reload
end end
@ -134,8 +142,10 @@ describe Admin::AttestationTemplatesController, type: :controller do
.and_return(double(full_messages: ['nop'])) .and_return(double(full_messages: ['nop']))
patch :update, patch :update,
params: { procedure_id: procedure.id, params: {
attestation_template: attestation_params_with_images } procedure_id: procedure.id,
attestation_template: attestation_params_with_images
}
procedure.reload procedure.reload
end end

View file

@ -24,10 +24,11 @@ describe Admin::MailTemplatesController, type: :controller do
before :each do before :each do
patch :update, patch :update,
params: { procedure_id: procedure.id, params: {
id: initiated_mail.class.const_get(:SLUG), procedure_id: procedure.id,
mail_template: { subject: mail_subject, body: mail_body } id: initiated_mail.class.const_get(:SLUG),
} mail_template: { subject: mail_subject, body: mail_body }
}
end end
it { expect(response).to redirect_to admin_procedure_mail_templates_path(procedure) } it { expect(response).to redirect_to admin_procedure_mail_templates_path(procedure) }

View file

@ -41,27 +41,26 @@ describe Admin::TypesDeChampController, type: :controller do
let(:mandatory) { 'on' } let(:mandatory) { 'on' }
let(:procedure_params) do let(:procedure_params) do
{types_de_champ_attributes: {
{'0' => types_de_champ_attributes: {
{ '0' => {
libelle: libelle, libelle: libelle,
type_champ: type_champ, type_champ: type_champ,
description: description, description: description,
order_place: order_place, order_place: order_place,
id: types_de_champ_id, id: types_de_champ_id,
mandatory: mandatory mandatory: mandatory
}, },
'1' => '1' => {
{ libelle: '',
libelle: '', type_champ: 'text',
type_champ: 'text', description: '',
description: '', order_place: '1',
order_place: '1', id: '',
id: '', mandatory: false,
mandatory: false, type: 'TypeDeChampPublic'
type: 'TypeDeChampPublic' }
} }
}
} }
end end

View file

@ -41,28 +41,27 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
let(:mandatory) { 'on' } let(:mandatory) { 'on' }
let(:procedure_params) do let(:procedure_params) do
{types_de_champ_private_attributes: {
{'0' => types_de_champ_private_attributes: {
{ '0' => {
libelle: libelle, libelle: libelle,
type_champ: type_champ, type_champ: type_champ,
description: description, description: description,
order_place: order_place, order_place: order_place,
id: types_de_champ_id, id: types_de_champ_id,
mandatory: mandatory, mandatory: mandatory,
type: 'TypeDeChampPrivate' type: 'TypeDeChampPrivate'
}, },
'1' => '1' => {
{ libelle: '',
libelle: '', type_champ: 'text',
type_champ: 'text', description: '',
description: '', order_place: '1',
order_place: '1', id: '',
id: '', mandatory: false,
mandatory: false, type: 'TypeDeChampPrivate'
type: 'TypeDeChampPrivate' }
} }
}
} }
end end

View file

@ -220,11 +220,13 @@ describe NewGestionnaire::AvisController, type: :controller do
.with(avis_id.to_s, invited_email) .with(avis_id.to_s, invited_email)
.and_return(invitations_email) .and_return(invitations_email)
post :create_gestionnaire, params: { id: avis_id, post :create_gestionnaire, params: {
email: invited_email, id: avis_id,
gestionnaire: { email: invited_email,
password: password gestionnaire: {
} } password: password
}
}
end end
context 'when the email does not belong to the invitation' do context 'when the email does not belong to the invitation' do

View file

@ -230,10 +230,12 @@ describe NewGestionnaire::DossiersController, type: :controller do
let(:procedure) { create(:procedure, :published, attestation_template: template, gestionnaires: [gestionnaire]) } let(:procedure) { create(:procedure, :published, attestation_template: template, gestionnaires: [gestionnaire]) }
subject do subject do
post :terminer, params: { process_action: "accepter", post :terminer, params: {
procedure_id: procedure.id, process_action: "accepter",
dossier_id: dossier.id, procedure_id: procedure.id,
dossier: { motivation: "Yallah" }} dossier_id: dossier.id,
dossier: { motivation: "Yallah" }
}
end end
before do before do

View file

@ -300,9 +300,11 @@ shared_examples 'description_controller_spec' do
context 'Sauvegarde des pièces justificatives', vcr: { cassette_name: 'controllers_users_description_controller_sauvegarde_pj' } do context 'Sauvegarde des pièces justificatives', vcr: { cassette_name: 'controllers_users_description_controller_sauvegarde_pj' } do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids } let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
before do before do
post :update, params: { dossier_id: dossier_id, post :update, params: {
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0, dossier_id: dossier_id,
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1 } 'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1
}
dossier.reload dossier.reload
end end
@ -310,9 +312,11 @@ shared_examples 'description_controller_spec' do
it 'ClamavService safe_file? is call' do it 'ClamavService safe_file? is call' do
expect(ClamavService).to receive(:safe_file?).twice expect(ClamavService).to receive(:safe_file?).twice
post :update, params: { dossier_id: dossier_id, post :update, params: {
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0, dossier_id: dossier_id,
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1 } 'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1
}
end end
end end
@ -348,9 +352,12 @@ shared_examples 'description_controller_spec' do
describe 'POST #pieces_justificatives', vcr: { cassette_name: 'controllers_users_description_controller_pieces_justificatives' } do describe 'POST #pieces_justificatives', vcr: { cassette_name: 'controllers_users_description_controller_pieces_justificatives' } do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids } let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
subject { patch :pieces_justificatives, params: { dossier_id: dossier.id, subject {
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0, patch :pieces_justificatives, params: {
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1 } 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
}
} }
context 'when user is a guest' do context 'when user is a guest' do
@ -424,9 +431,12 @@ end
shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner' do shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner' do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids } let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
subject { patch :pieces_justificatives, params: { dossier_id: dossier.id, subject {
'piece_justificative_' + all_pj_type[0].to_s => piece_justificative_0, patch :pieces_justificatives, params: {
'piece_justificative_' + all_pj_type[1].to_s => piece_justificative_1 } 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
}
} }
context 'when user is the owner', vcr: { cassette_name: 'controllers_users_description_controller_pieces_justificatives' } do context 'when user is the owner', vcr: { cassette_name: 'controllers_users_description_controller_pieces_justificatives' } do