Enable the Layout/BlockEndNewline cop

This commit is contained in:
gregoirenovel 2017-06-12 14:10:49 +02:00
parent 9439e1abb1
commit bc16027ccc
12 changed files with 89 additions and 55 deletions

View file

@ -18,7 +18,7 @@ Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation
Layout/BlockEndNewline:
Enabled: false
Enabled: true
Layout/CaseIndentation:
Enabled: false

View file

@ -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

View file

@ -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') }

View file

@ -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

View file

@ -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

View file

@ -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 }

View file

@ -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))

View file

@ -31,7 +31,8 @@ describe CARTO::SGMAP::Cadastre::Adapter do
:code_dep,
:nom_com,
:code_com,
:code_arr] }
:code_arr]
}
end
describe 'Attributes' do

View file

@ -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

View file

@ -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

View file

@ -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 }

View file

@ -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