Enable the Layout/SpaceInsideArrayLiteralBrackets
This commit is contained in:
parent
386fbce776
commit
186e362701
12 changed files with 36 additions and 35 deletions
|
@ -252,7 +252,8 @@ Layout/SpaceInsideHashLiteralBraces:
|
|||
Enabled: true
|
||||
|
||||
Layout/SpaceInsideArrayLiteralBrackets:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
EnforcedStyle: no_space
|
||||
|
||||
Layout/SpaceInsideParens:
|
||||
Enabled: true
|
||||
|
|
|
@ -36,7 +36,7 @@ class Champ < ApplicationRecord
|
|||
end
|
||||
|
||||
def search_terms
|
||||
[ to_s ]
|
||||
[to_s]
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Champs::CheckboxChamp < Champ
|
||||
def search_terms
|
||||
if value == 'on'
|
||||
[ libelle ]
|
||||
[libelle]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Champs::EngagementChamp < Champs::CheckboxChamp
|
||||
def search_terms
|
||||
if value == 'on'
|
||||
[ libelle ]
|
||||
[libelle]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ class Champs::LinkedDropDownListChamp < Champ
|
|||
end
|
||||
|
||||
def search_terms
|
||||
[ primary_value, secondary_value ]
|
||||
[primary_value, secondary_value]
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -52,6 +52,6 @@ class Champs::LinkedDropDownListChamp < Champ
|
|||
end
|
||||
|
||||
def pack_value(primary, secondary)
|
||||
self.value = JSON.generate([ primary, secondary ])
|
||||
self.value = JSON.generate([primary, secondary])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,6 +40,6 @@ class Champs::SiretChamp < Champ
|
|||
accepts_nested_attributes_for :etablissement, allow_destroy: true, update_only: true
|
||||
|
||||
def search_terms
|
||||
etablissement.present? ? etablissement.search_terms : [ value ]
|
||||
etablissement.present? ? etablissement.search_terms : [value]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Champs::YesNoChamp < Champs::CheckboxChamp
|
||||
def search_terms
|
||||
if value == 'true'
|
||||
[ libelle ]
|
||||
[libelle]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
def valid_columns_for_table(table)
|
||||
@column_whitelist ||= fields
|
||||
.group_by { |field| field['table'] }
|
||||
.map { |table, fields| [table, Set.new(fields.map { |field| field['column'] }) ] }
|
||||
.map { |table, fields| [table, Set.new(fields.map { |field| field['column'] })] }
|
||||
.to_h
|
||||
|
||||
@column_whitelist[table] || []
|
||||
|
|
|
@ -10,7 +10,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|||
t.string :checksum, null: false
|
||||
t.datetime :created_at, null: false
|
||||
|
||||
t.index [ :key ], unique: true
|
||||
t.index [:key], unique: true
|
||||
end
|
||||
|
||||
create_table :active_storage_attachments do |t|
|
||||
|
@ -20,7 +20,7 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|||
|
||||
t.datetime :created_at, null: false
|
||||
|
||||
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||
t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,21 +10,21 @@ RSpec.describe ConservationDeDonneesHelper, type: :helper do
|
|||
let(:dans_ds) { 3 }
|
||||
let(:hors_ds) { 6 }
|
||||
|
||||
it { is_expected.to eq([ "Dans demarches-simplifiees.fr : 3 mois", "Par l’administration : 6 mois" ]) }
|
||||
it { is_expected.to eq(["Dans demarches-simplifiees.fr : 3 mois", "Par l’administration : 6 mois"]) }
|
||||
end
|
||||
|
||||
context "when only in-app retention time is set" do
|
||||
let(:dans_ds) { 3 }
|
||||
let(:hors_ds) { nil }
|
||||
|
||||
it { is_expected.to eq([ "Dans demarches-simplifiees.fr : 3 mois" ]) }
|
||||
it { is_expected.to eq(["Dans demarches-simplifiees.fr : 3 mois"]) }
|
||||
end
|
||||
|
||||
context "when only out of app retention time is set" do
|
||||
let(:dans_ds) { nil }
|
||||
let(:hors_ds) { 6 }
|
||||
|
||||
it { is_expected.to eq([ "Par l’administration : 6 mois" ]) }
|
||||
it { is_expected.to eq(["Par l’administration : 6 mois"]) }
|
||||
end
|
||||
|
||||
context "when the retention time is not set" do
|
||||
|
|
|
@ -128,7 +128,7 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_address) }
|
||||
let(:value) { "10 rue du Pinson qui Piaille" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for checkbox champ' do
|
||||
|
@ -138,7 +138,7 @@ describe Champ do
|
|||
context 'when the box is checked' do
|
||||
let(:value) { 'on' }
|
||||
|
||||
it { is_expected.to eq([ libelle ]) }
|
||||
it { is_expected.to eq([libelle]) }
|
||||
end
|
||||
|
||||
context 'when the box is unchecked' do
|
||||
|
@ -152,7 +152,7 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_civilite) }
|
||||
let(:value) { "M." }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for date champ' do
|
||||
|
@ -173,28 +173,28 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_departements) }
|
||||
let(:value) { "69 - Rhône" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for dossier link champ' do
|
||||
let(:type_de_champ) { build(:type_de_champ_dossier_link) }
|
||||
let(:value) { "9103132886" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for drop down list champ' do
|
||||
let(:type_de_champ) { build(:type_de_champ_dossier_link) }
|
||||
let(:value) { "HLM" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for email champ' do
|
||||
let(:type_de_champ) { build(:type_de_champ_email) }
|
||||
let(:value) { "machin@example.com" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for engagement champ' do
|
||||
|
@ -204,7 +204,7 @@ describe Champ do
|
|||
context 'when the box is checked' do
|
||||
let(:value) { 'on' }
|
||||
|
||||
it { is_expected.to eq([ libelle ]) }
|
||||
it { is_expected.to eq([libelle]) }
|
||||
end
|
||||
|
||||
context 'when the box is unchecked' do
|
||||
|
@ -239,7 +239,7 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_multiple_drop_down_list) }
|
||||
|
||||
context 'when there are multiple values selected' do
|
||||
let(:value) { JSON.generate([ 'goodbye', 'cruel', 'world' ]) }
|
||||
let(:value) { JSON.generate(['goodbye', 'cruel', 'world']) }
|
||||
|
||||
it { is_expected.to eq(["goodbye", "cruel", "world"]) }
|
||||
end
|
||||
|
@ -255,21 +255,21 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_number) }
|
||||
let(:value) { "1234" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for pays champ' do
|
||||
let(:type_de_champ) { build(:type_de_champ_pays) }
|
||||
let(:value) { "FRANCE" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for phone champ' do
|
||||
let(:type_de_champ) { build(:type_de_champ_phone) }
|
||||
let(:value) { "0606060606" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for pièce justificative champ' do
|
||||
|
@ -283,7 +283,7 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_regions) }
|
||||
let(:value) { "Île-de-France" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for siret champ' do
|
||||
|
@ -325,14 +325,14 @@ describe Champ do
|
|||
end
|
||||
let(:champ) { type_de_champ.champ.build(value: etablissement.siret, etablissement: etablissement) }
|
||||
|
||||
it { is_expected.to eq([ etablissement.entreprise_siren, etablissement.entreprise_numero_tva_intracommunautaire, etablissement.entreprise_forme_juridique, etablissement.entreprise_forme_juridique_code, etablissement.entreprise_nom_commercial, etablissement.entreprise_raison_sociale, etablissement.entreprise_siret_siege_social, etablissement.entreprise_nom, etablissement.entreprise_prenom, etablissement.association_rna, etablissement.association_titre, etablissement.association_objet, etablissement.siret, etablissement.naf, etablissement.libelle_naf, etablissement.adresse, etablissement.code_postal, etablissement.localite, etablissement.code_insee_localite ]) }
|
||||
it { is_expected.to eq([etablissement.entreprise_siren, etablissement.entreprise_numero_tva_intracommunautaire, etablissement.entreprise_forme_juridique, etablissement.entreprise_forme_juridique_code, etablissement.entreprise_nom_commercial, etablissement.entreprise_raison_sociale, etablissement.entreprise_siret_siege_social, etablissement.entreprise_nom, etablissement.entreprise_prenom, etablissement.association_rna, etablissement.association_titre, etablissement.association_objet, etablissement.siret, etablissement.naf, etablissement.libelle_naf, etablissement.adresse, etablissement.code_postal, etablissement.localite, etablissement.code_insee_localite]) }
|
||||
end
|
||||
|
||||
context 'when there is no etablissement' do
|
||||
let(:siret) { "35130347400024" }
|
||||
let(:champ) { type_de_champ.champ.build(value: siret) }
|
||||
|
||||
it { is_expected.to eq([ siret ]) }
|
||||
it { is_expected.to eq([siret]) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -340,14 +340,14 @@ describe Champ do
|
|||
let(:type_de_champ) { build(:type_de_champ_text) }
|
||||
let(:value) { "Blah" }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for text area champ' do
|
||||
let(:type_de_champ) { build(:type_de_champ_textarea) }
|
||||
let(:value) { "Bla\nBlah de bla." }
|
||||
|
||||
it { is_expected.to eq([ value ]) }
|
||||
it { is_expected.to eq([value]) }
|
||||
end
|
||||
|
||||
context 'for yes/no champ' do
|
||||
|
@ -357,7 +357,7 @@ describe Champ do
|
|||
context 'when the box is checked' do
|
||||
let(:value) { "true" }
|
||||
|
||||
it { is_expected.to eq([ libelle ]) }
|
||||
it { is_expected.to eq([libelle]) }
|
||||
end
|
||||
|
||||
context 'when the box is unchecked' do
|
||||
|
|
|
@ -96,13 +96,13 @@ describe TypesDeChamp::LinkedDropDownListTypeDeChamp do
|
|||
expect(subject.secondary_options).to eq(
|
||||
{
|
||||
'' => [],
|
||||
'Primary 1' => [ '', 'secondary 1.1', 'secondary 1.2'],
|
||||
'Primary 2' => [ '', 'secondary 2.1', 'secondary 2.2', 'secondary 2.3']
|
||||
'Primary 1' => ['', 'secondary 1.1', 'secondary 1.2'],
|
||||
'Primary 2' => ['', 'secondary 2.1', 'secondary 2.2', 'secondary 2.3']
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it { expect(subject.primary_options).to eq([ '', 'Primary 1', 'Primary 2' ]) }
|
||||
it { expect(subject.primary_options).to eq(['', 'Primary 1', 'Primary 2']) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue