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
Layout/FirstHashElementLineBreak:
Enabled: false
Enabled: true
Layout/FirstMethodArgumentLineBreak:
Enabled: false

View file

@ -29,20 +29,28 @@ module TagsSubstitutionConcern
def dossier_tags
[
{ libelle: 'motivation',
{
libelle: 'motivation',
description: 'Motivation facultative associée à la décision finale dacceptation, refus ou classement sans suite',
target: :motivation,
dossier_termine_only: true },
{ libelle: 'date de dépôt',
dossier_termine_only: true
},
{
libelle: 'date de dépôt',
description: 'Date du passage en construction du dossier par lusager',
lambda: -> (d) { format_date(d.en_construction_at) } },
{ libelle: 'date de passage en instruction',
lambda: -> (d) { format_date(d.en_construction_at) }
},
{
libelle: 'date de passage en instruction',
description: '',
lambda: -> (d) { format_date(d.en_instruction_at) } },
{ libelle: 'date de décision',
lambda: -> (d) { format_date(d.en_instruction_at) }
},
{
libelle: 'date de décision',
description: 'Date de la décision dacceptation, refus, ou classement sans suite',
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: '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
User.all.each do |user|
FranceConnectInformation.create({gender: user.gender,
given_name: user.given_name,
family_name: user.family_name,
birthdate: user.birthdate,
birthplace: user.birthplace,
france_connect_particulier_id: user.france_connect_particulier_id,
user_id: user.id}) if user.france_connect_particulier_id.present?
FranceConnectInformation.create({
gender: user.gender,
given_name: user.given_name,
family_name: user.family_name,
birthdate: user.birthdate,
birthplace: user.birthplace,
france_connect_particulier_id: user.france_connect_particulier_id,
user_id: user.id
}) if user.france_connect_particulier_id.present?
end
remove_column :users, :gender
@ -44,12 +46,14 @@ class CreateFranceConnectInformation < ActiveRecord::Migration
add_column :users, :france_connect_particulier_id, :string
FranceConnectInformation.all.each do |fci|
User.find(fci.user_id).update_attributes({gender: fci.gender,
given_name: fci.given_name,
family_name: fci.family_name,
birthdate: fci.birthdate,
birthplace: fci.birthplace,
france_connect_particulier_id: fci.france_connect_particulier_id})
User.find(fci.user_id).update_attributes({
gender: fci.gender,
given_name: fci.given_name,
family_name: fci.family_name,
birthdate: fci.birthdate,
birthplace: fci.birthplace,
france_connect_particulier_id: fci.france_connect_particulier_id
})
end
drop_table :france_connect_informations

View file

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

View file

@ -24,10 +24,11 @@ describe Admin::MailTemplatesController, type: :controller do
before :each do
patch :update,
params: { procedure_id: procedure.id,
id: initiated_mail.class.const_get(:SLUG),
mail_template: { subject: mail_subject, body: mail_body }
}
params: {
procedure_id: procedure.id,
id: initiated_mail.class.const_get(:SLUG),
mail_template: { subject: mail_subject, body: mail_body }
}
end
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(:procedure_params) do
{types_de_champ_attributes:
{'0' =>
{
libelle: libelle,
type_champ: type_champ,
description: description,
order_place: order_place,
id: types_de_champ_id,
mandatory: mandatory
},
'1' =>
{
libelle: '',
type_champ: 'text',
description: '',
order_place: '1',
id: '',
mandatory: false,
type: 'TypeDeChampPublic'
}
}
{
types_de_champ_attributes: {
'0' => {
libelle: libelle,
type_champ: type_champ,
description: description,
order_place: order_place,
id: types_de_champ_id,
mandatory: mandatory
},
'1' => {
libelle: '',
type_champ: 'text',
description: '',
order_place: '1',
id: '',
mandatory: false,
type: 'TypeDeChampPublic'
}
}
}
end

View file

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

View file

@ -220,11 +220,13 @@ describe NewGestionnaire::AvisController, type: :controller do
.with(avis_id.to_s, invited_email)
.and_return(invitations_email)
post :create_gestionnaire, params: { id: avis_id,
email: invited_email,
gestionnaire: {
password: password
} }
post :create_gestionnaire, params: {
id: avis_id,
email: invited_email,
gestionnaire: {
password: password
}
}
end
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]) }
subject do
post :terminer, params: { process_action: "accepter",
procedure_id: procedure.id,
dossier_id: dossier.id,
dossier: { motivation: "Yallah" }}
post :terminer, params: {
process_action: "accepter",
procedure_id: procedure.id,
dossier_id: dossier.id,
dossier: { motivation: "Yallah" }
}
end
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
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
before do
post :update, 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 }
post :update, 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
}
dossier.reload
end
@ -310,9 +312,11 @@ shared_examples 'description_controller_spec' do
it 'ClamavService safe_file? is call' do
expect(ClamavService).to receive(:safe_file?).twice
post :update, 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 }
post :update, 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
}
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
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
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 }
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
}
}
context 'when user is a guest' do
@ -424,9 +431,12 @@ end
shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner' do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
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 }
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
}
}
context 'when user is the owner', vcr: { cassette_name: 'controllers_users_description_controller_pieces_justificatives' } do