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 EnforcedStyle: with_fixed_indentation
Layout/BlockEndNewline: Layout/BlockEndNewline:
Enabled: false Enabled: true
Layout/CaseIndentation: Layout/CaseIndentation:
Enabled: false Enabled: false

View file

@ -26,12 +26,14 @@ class ModuleApiCartoService
def self.generate_qp coordinates def self.generate_qp coordinates
coordinates.inject({}) { |acc, coordinate| coordinates.inject({}) { |acc, coordinate|
acc.merge CARTO::SGMAP::QuartiersPrioritaires::Adapter.new( 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 end
def self.generate_cadastre coordinates def self.generate_cadastre coordinates
(coordinates.inject([]) { |acc, coordinate| (coordinates.inject([]) { |acc, coordinate|
acc << CARTO::SGMAP::Cadastre::Adapter.new( 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
end end

View file

@ -144,7 +144,8 @@ describe API::V1::DossiersController do
:code_effectif_entreprise, :code_effectif_entreprise,
:date_creation, :date_creation,
:nom, :nom,
:prenom] } :prenom]
}
subject { super()[:entreprise] } subject { super()[:entreprise] }
it { expect(subject[:siren]).to eq('440117620') } it { expect(subject[:siren]).to eq('440117620') }
@ -164,7 +165,8 @@ describe API::V1::DossiersController do
let(:field_list) { [ let(:field_list) { [
:id, :id,
:libelle, :libelle,
:description] } :description]
}
subject { super()[:types_de_piece_justificative] } subject { super()[:types_de_piece_justificative] }
it { expect(subject.length).to eq 2 } it { expect(subject.length).to eq 2 }
@ -184,9 +186,9 @@ describe API::V1::DossiersController do
end end
let(:field_list) { [ let(:field_list) { [
:url, :created_at, :type_de_piece_justificative_id] } :url, :created_at, :type_de_piece_justificative_id]
subject { }
super()[:pieces_justificatives].first } subject { super()[:pieces_justificatives].first }
it { expect(subject.keys.include?(:content_url)).to be_truthy } it { expect(subject.keys.include?(:content_url)).to be_truthy }
it { expect(subject[:created_at]).not_to be_nil } it { expect(subject[:created_at]).not_to be_nil }
@ -203,7 +205,8 @@ describe API::V1::DossiersController do
describe 'champs' do describe 'champs' do
let(:field_list) { [ let(:field_list) { [
:url] } :url]
}
subject { super()[:champs] } subject { super()[:champs] }
it { expect(subject.length).to eq 1 } it { expect(subject.length).to eq 1 }
@ -220,7 +223,8 @@ describe API::V1::DossiersController do
:libelle, :libelle,
:description, :description,
:order_place, :order_place,
:type] } :type]
}
subject { super()[:type_de_champ] } subject { super()[:type_de_champ] }
it { expect(subject.keys.include?(:id)).to be_truthy } it { expect(subject.keys.include?(:id)).to be_truthy }
@ -234,7 +238,8 @@ describe API::V1::DossiersController do
describe 'champs_private' do describe 'champs_private' do
let(:field_list) { [ let(:field_list) { [
:url] } :url]
}
subject { super()[:champs_private] } subject { super()[:champs_private] }
it { expect(subject.length).to eq 1 } it { expect(subject.length).to eq 1 }
@ -251,7 +256,8 @@ describe API::V1::DossiersController do
:libelle, :libelle,
:description, :description,
:order_place, :order_place,
:type] } :type]
}
subject { super()[:type_de_champ] } subject { super()[:type_de_champ] }
it { expect(subject.keys.include?(:id)).to be_truthy } it { expect(subject.keys.include?(:id)).to be_truthy }
@ -298,9 +304,9 @@ describe API::V1::DossiersController do
describe 'user' do describe 'user' do
let(:field_list) { [ let(:field_list) { [
:url, :created_at, :type_de_piece_justificative_id] } :url, :created_at, :type_de_piece_justificative_id]
subject { }
super()[:user] } subject { super()[:user] }
it { expect(subject[:email]).not_to be_nil } it { expect(subject[:email]).not_to be_nil }
end end
@ -320,7 +326,8 @@ describe API::V1::DossiersController do
:code_postal, :code_postal,
:localite, :localite,
:code_insee_localite :code_insee_localite
] } ]
}
subject { super()[:etablissement] } subject { super()[:etablissement] }
it { expect(subject[:siret]).to eq('44011762001530') } it { expect(subject[:siret]).to eq('44011762001530') }

View file

@ -17,7 +17,8 @@ describe StatsController, type: :controller do
it { expect(subject).to eq([ it { expect(subject).to eq([
[I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1], [I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 1],
[I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 2] [I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 2]
] ) } ])
}
end end
context "with a date attribute" do context "with a date attribute" do
@ -35,7 +36,8 @@ describe StatsController, type: :controller do
it { expect(subject).to eq([ it { expect(subject).to eq([
[I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 2], [I18n.l(45.days.ago.beginning_of_month, format: "%B %Y"), 2],
[I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 1] [I18n.l(1.days.ago.beginning_of_month, format: "%B %Y"), 1]
] ) } ])
}
end end
end end
@ -52,9 +54,10 @@ describe StatsController, type: :controller do
subject { StatsController.new.send(:cumulative_hash, association) } subject { StatsController.new.send(:cumulative_hash, association) }
it { expect(subject).to eq({ it { expect(subject).to eq({
45.days.ago.beginning_of_month => 1, 45.days.ago.beginning_of_month => 1,
15.days.ago.beginning_of_month => 3 15.days.ago.beginning_of_month => 3
}) } })
}
end end
context "with a date attribute" do context "with a date attribute" do
@ -69,9 +72,10 @@ describe StatsController, type: :controller do
subject { StatsController.new.send(:cumulative_hash, association, :updated_at) } subject { StatsController.new.send(:cumulative_hash, association, :updated_at) }
it { expect(subject).to eq({ it { expect(subject).to eq({
20.days.ago.beginning_of_month => 2, 20.days.ago.beginning_of_month => 2,
10.days.ago.beginning_of_month => 3 10.days.ago.beginning_of_month => 3
}) } })
}
end end
end end

View file

@ -161,7 +161,8 @@ shared_examples 'description_controller_spec' do
context 'Quand la procédure accepte les CERFA' do context 'Quand la procédure accepte les CERFA' do
subject { post :update, params: {dossier_id: dossier_id, subject { post :update, params: {dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf} } cerfa_pdf: cerfa_pdf}
}
it 'Notification interne is create' do it 'Notification interne is create' do
expect { subject }.to change(Notification, :count).by (1) 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, 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[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 context 'when user is a guest' do
let(:guest) { create :user } 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, 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[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 context 'when user is the owner', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do
before do before do

View file

@ -10,14 +10,16 @@ describe DossiersListFacades do
gestionnaire: gestionnaire, gestionnaire: gestionnaire,
table: nil, table: nil,
attr: 'state', attr: 'state',
attr_decorate: 'display_state' } attr_decorate: 'display_state'
}
let!(:preference_2) { create :preference_list_dossier, let!(:preference_2) { create :preference_list_dossier,
gestionnaire: gestionnaire, gestionnaire: gestionnaire,
table: 'champs', table: 'champs',
attr: 'state', attr: 'state',
attr_decorate: 'display_state', attr_decorate: 'display_state',
procedure_id: procedure.id } procedure_id: procedure.id
}
before do before do
create :assign_to, procedure: procedure, gestionnaire: gestionnaire create :assign_to, procedure: procedure, gestionnaire: gestionnaire
@ -63,7 +65,8 @@ describe DossiersListFacades do
attr: 'state', attr: 'state',
attr_decorate: 'display_state', attr_decorate: 'display_state',
filter: filter, filter: filter,
procedure_id: procedure_id } procedure_id: procedure_id
}
subject { facade.active_filter? preference } subject { facade.active_filter? preference }

View file

@ -17,7 +17,8 @@ feature 'France Connect Particulier Connexion' do
birthdate: birthdate, birthdate: birthdate,
birthplace: birthplace, birthplace: birthplace,
gender: gender, gender: gender,
email: email) } email: email)
}
context 'when user is on login page' do context 'when user is on login page' do
@ -40,7 +41,8 @@ feature 'France Connect Particulier Connexion' do
birthdate: birthdate, birthdate: birthdate,
birthplace: birthplace, birthplace: birthplace,
gender: gender, gender: gender,
email_france_connect: email) } email_france_connect: email)
}
before do before do
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code)) 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, :code_dep,
:nom_com, :nom_com,
:code_com, :code_com,
:code_arr] } :code_arr]
}
end end
describe 'Attributes' do describe 'Attributes' do

View file

@ -17,7 +17,8 @@ describe DropDownList do
Dév.Eco / Emploi Dév.Eco / Emploi
Cadre de vie / Urb. Cadre de vie / Urb.
Pilotage / Ingénierie Pilotage / Ingénierie
" } "
}
it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', '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. Cadre de vie / Urb.
Pilotage / Ingénierie Pilotage / Ingénierie
" } "
}
it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] } it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] }
end end
@ -36,7 +38,8 @@ Pilotage / Ingénierie
let(:value) { "tip let(:value) { "tip
--top-- --top--
--troupt-- --troupt--
ouaich" } ouaich"
}
it { expect(dropdownlist.disabled_options).to match(['--top--', '--troupt--']) } it { expect(dropdownlist.disabled_options).to match(['--top--', '--troupt--']) }
end end

View file

@ -204,7 +204,8 @@ describe Gestionnaire, type: :model do
it { is_expected.to eq 0 } it { is_expected.to eq 0 }
it { expect(gestionnaire.follows.count).to eq 0 } it { expect(gestionnaire.follows.count).to eq 0 }
it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject) it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject)
subject } subject
}
end end
context 'when gestionnaire follow any dossier into the procedure past in params' do 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 { is_expected.to eq 0 }
it { expect(gestionnaire.follows.count).to eq 1 } it { expect(gestionnaire.follows.count).to eq 1 }
it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject) it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject)
subject } subject
}
end end
context 'when gestionnaire follow a dossier with a notification into the procedure past in params' do 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 { is_expected.to eq 1 }
it { expect(gestionnaire.follows.count).to eq 1 } it { expect(gestionnaire.follows.count).to eq 1 }
it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).to receive(:inject) it { expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).to receive(:inject)
subject } subject
}
end end
end end

View file

@ -49,7 +49,8 @@ describe DossiersListGestionnaireService do
let(:order) { 'desc' } let(:order) { 'desc' }
let(:select_preference_list_dossier) { gestionnaire.preference_list_dossiers 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 } subject { DossiersListGestionnaireService.new(gestionnaire, liste).change_sort! param_sort }
@ -99,7 +100,8 @@ describe DossiersListGestionnaireService do
let(:filter_value) { 'plop' } let(:filter_value) { 'plop' }
let(:select_preference_list_dossier) { gestionnaire.preference_list_dossiers 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 } 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 describe 'users/description/_pieces_justificatives.html.haml', type: :view do
let!(:procedure) { create(:procedure) } let!(:procedure) { create(:procedure) }
let!(:tpj1) { create(:type_de_piece_justificative, let!(:tpj1) {
procedure: procedure, create(:type_de_piece_justificative,
libelle: "Première pièce jointe", procedure: procedure,
description: "Première description", libelle: "Première pièce jointe",
order_place: 1, description: "Première description",
mandatory: true order_place: 1,
)} mandatory: true
let!(:tpj2) { create(:type_de_piece_justificative, )
procedure: procedure, }
libelle: "Seconde pièce jointe", let!(:tpj2) {
description: "Seconde description", create(:type_de_piece_justificative,
order_place: 2, procedure: procedure,
lien_demarche: "https://www.google.fr" libelle: "Seconde pièce jointe",
)} description: "Seconde description",
order_place: 2,
lien_demarche: "https://www.google.fr"
)
}
let!(:dossier) { create(:dossier, :procedure => procedure) } let!(:dossier) { create(:dossier, :procedure => procedure) }
before do before do