Enable the Layout/MultilineAssignmentLayout cop

This commit is contained in:
gregoirenovel 2018-01-15 19:22:02 +01:00
parent 14c1747645
commit 9d75526460
7 changed files with 66 additions and 50 deletions

View file

@ -131,7 +131,7 @@ Layout/MultilineAssignmentLayout:
Enabled: false
Layout/MultilineBlockLayout:
Enabled: false
Enabled: true
Layout/MultilineHashBraceLayout:
Enabled: false

View file

@ -208,15 +208,20 @@ class Admin::ProceduresController < AdminController
end
def path_list
render json: ProcedurePath
json_path_list = ProcedurePath
.joins(', procedures')
.where("procedures.id = procedure_paths.procedure_id")
.where("procedures.archived_at" => nil)
.where("path LIKE ?", "%#{params[:request]}%")
.pluck(:path, :administrateur_id)
.inject([]) {
|acc, value| acc.push({label: value.first, mine: value.second == current_administrateur.id})
}.to_json
.map do |value|
{
label: value.first,
mine: value.second == current_administrateur.id
}
end.to_json
render json: json_path_list
end
private

View file

@ -2,9 +2,11 @@ class Ban::SearchController < ApplicationController
def get
request = params[:request]
render json: Carto::Bano::AddressRetriever.new(request).list.inject([]) {
|acc, value| acc.push({label: value})
}.to_json
json = Carto::Bano::AddressRetriever.new(request).list.map do |value|
{ label: value }
end.to_json
render json: json
end
def get_address_point

View file

@ -200,8 +200,7 @@ describe API::V1::DossiersController do
end
describe 'champs' do
let(:field_list) { [:url]
}
let(:field_list) { [:url] }
subject { super()[:champs] }
it { expect(subject.length).to eq 1 }

View file

@ -35,7 +35,8 @@ feature 'France Connect Particulier Connexion' do
let(:code) { 'plop' }
context 'when authentification is ok' do
let(:france_connect_information) { create(:france_connect_information,
let(:france_connect_information) do
create(:france_connect_information,
france_connect_particulier_id: france_connect_particulier_id,
given_name: given_name,
family_name: family_name,
@ -43,7 +44,7 @@ feature 'France Connect Particulier Connexion' do
birthplace: birthplace,
gender: gender,
email_france_connect: email)
}
end
before do
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))

View file

@ -211,11 +211,12 @@ describe Dossier do
it { expect(subject).to include(:individual_nom) }
it { expect(subject).to include(:individual_prenom) }
it { expect(subject).to include(:individual_birthdate) }
it { expect(subject.count).to eq(DossierTableExportSerializer.new(dossier).attributes.count +
it do
expect(subject.count).to eq(DossierTableExportSerializer.new(dossier).attributes.count +
dossier.procedure.types_de_champ.count +
dossier.procedure.types_de_champ_private.count +
dossier.export_entreprise_data.count)
}
end
end
describe '#to_sorted_values' do
@ -238,11 +239,12 @@ describe Dossier do
it { expect(subject[14]).to be_nil }
it { expect(subject[15]).to be_nil }
it { expect(subject[16]).to be_nil }
it { expect(subject.count).to eq(DossierTableExportSerializer.new(dossier).attributes.count +
it do
expect(subject.count).to eq(DossierTableExportSerializer.new(dossier).attributes.count +
dossier.procedure.types_de_champ.count +
dossier.procedure.types_de_champ_private.count +
dossier.export_entreprise_data.count)
}
end
context 'dossier for individual' do
let(:dossier_with_individual) { create(:dossier, :for_individual, user: user, procedure: procedure) }

View file

@ -4,32 +4,39 @@ describe DropDownList do
let(:dropdownlist) { create :drop_down_list, value: value }
describe '#options' do
let(:value) { "Cohésion sociale
Dév.Eco / Emploi
Cadre de vie / Urb.
Pilotage / Ingénierie
"
}
let(:value) do
<<~EOS
Cohésion sociale
Dév.Eco / Emploi
Cadre de vie / Urb.
Pilotage / Ingénierie
EOS
end
it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Dév.Eco / Emploi', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] }
context 'when one value is empty' do
let(:value) { "Cohésion sociale
Cadre de vie / Urb.
Pilotage / Ingénierie
"
}
let(:value) do
<<~EOS
Cohésion sociale
Cadre de vie / Urb.
Pilotage / Ingénierie
EOS
end
it { expect(dropdownlist.options).to eq ['', 'Cohésion sociale', 'Cadre de vie / Urb.', 'Pilotage / Ingénierie'] }
end
end
describe 'disabled_options' do
let(:value) { "tip
--top--
--troupt--
ouaich"
}
let(:value) do
<<~EOS
tip
--top--
--troupt--
ouaich
EOS
end
it { expect(dropdownlist.disabled_options).to match(['--top--', '--troupt--']) }
end