Enable the Layout/IndentHash cop

This commit is contained in:
gregoirenovel 2018-01-15 19:02:12 +01:00
parent 3363e21427
commit 0be657c0d7
21 changed files with 163 additions and 155 deletions

View file

@ -105,7 +105,8 @@ Layout/IndentAssignment:
Enabled: true Enabled: true
Layout/IndentHash: Layout/IndentHash:
Enabled: false Enabled: true
EnforcedStyle: consistent
Layout/IndentHeredoc: Layout/IndentHeredoc:
Enabled: false Enabled: false

View file

@ -1,9 +1,9 @@
class API::StatistiquesController < ApplicationController class API::StatistiquesController < ApplicationController
def dossiers_stats def dossiers_stats
render json: { render json: {
total: total_dossiers, total: total_dossiers,
mois: dossiers_mois mois: dossiers_mois
} }
end end
private private

View file

@ -34,9 +34,9 @@ class API::V1::DossiersController < APIController
def pagination(dossiers) def pagination(dossiers)
{ {
page: dossiers.current_page, page: dossiers.current_page,
resultats_par_page: dossiers.limit_value, resultats_par_page: dossiers.limit_value,
nombre_de_page: dossiers.total_pages nombre_de_page: dossiers.total_pages
} }
end end

View file

@ -61,8 +61,8 @@ class Users::CarteController < UsersController
def self.route_authorization def self.route_authorization
{ {
states: [:brouillon, :en_construction], states: [:brouillon, :en_construction],
api_carto: true api_carto: true
} }
end end
end end

View file

@ -95,7 +95,7 @@ class Users::DescriptionController < UsersController
def self.route_authorization def self.route_authorization
{ {
states: [:brouillon, :en_construction] states: [:brouillon, :en_construction]
} }
end end

View file

@ -151,7 +151,7 @@ class Users::DossiersController < UsersController
def self.route_authorization def self.route_authorization
{ {
states: [:brouillon] states: [:brouillon]
} }
end end

View file

@ -18,7 +18,7 @@ class Users::RecapitulatifController < UsersController
def self.route_authorization def self.route_authorization
{ {
states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse] states: [:en_construction, :en_instruction, :sans_suite, :accepte, :refuse]
} }
end end

View file

@ -18,15 +18,15 @@ class CARTO::SGMAP::Cadastre::Adapter
def filter_properties properties def filter_properties properties
{ {
surface_intersection: properties[:surface_intersection], surface_intersection: properties[:surface_intersection],
surface_parcelle: properties[:surface_parcelle], surface_parcelle: properties[:surface_parcelle],
numero: properties[:numero], numero: properties[:numero],
feuille: properties[:feuille], feuille: properties[:feuille],
section: properties[:section], section: properties[:section],
code_dep: properties[:code_dep], code_dep: properties[:code_dep],
nom_com: properties[:nom_com], nom_com: properties[:nom_com],
code_com: properties[:code_com], code_com: properties[:code_com],
code_arr: properties[:code_arr] code_arr: properties[:code_arr]
} }
end end
end end

View file

@ -1,3 +1,3 @@
BROWSER = Hashie::Mash.new ({ BROWSER = Hashie::Mash.new ({
value: nil value: nil
}) })

View file

@ -1,4 +1,4 @@
CLAMAV = Hashie::Mash.new ({ CLAMAV = Hashie::Mash.new ({
mock?: true, mock?: true,
response: true response: true
}) })

View file

@ -18,19 +18,19 @@ Rails.application.routes.draw do
} }
devise_for :administrateurs, controllers: { devise_for :administrateurs, controllers: {
sessions: 'administrateurs/sessions' sessions: 'administrateurs/sessions'
}, skip: [:password, :registrations] }, skip: [:password, :registrations]
devise_for :gestionnaires, controllers: { devise_for :gestionnaires, controllers: {
sessions: 'gestionnaires/sessions', sessions: 'gestionnaires/sessions',
passwords: 'gestionnaires/passwords' passwords: 'gestionnaires/passwords'
}, skip: [:registrations] }, skip: [:registrations]
devise_for :users, controllers: { devise_for :users, controllers: {
sessions: 'users/sessions', sessions: 'users/sessions',
registrations: 'users/registrations', registrations: 'users/registrations',
passwords: 'users/passwords' passwords: 'users/passwords'
} }
devise_scope :user do devise_scope :user do
get '/users/sign_in/demo' => redirect("/users/sign_in") get '/users/sign_in/demo' => redirect("/users/sign_in")

View file

@ -50,11 +50,11 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
class PreferenceListDossier < ActiveRecord::Base class PreferenceListDossier < ActiveRecord::Base
def self.available_columns def self.available_columns
{ {
dossier: columns_dossier, dossier: columns_dossier,
procedure: columns_procedure, procedure: columns_procedure,
entreprise: columns_entreprise, entreprise: columns_entreprise,
etablissement: columns_etablissement, etablissement: columns_etablissement,
user: columns_user user: columns_user
} }
end end
@ -62,10 +62,10 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = nil table = nil
{ {
dossier_id: create_column('ID', table, 'id', 'id', 1), dossier_id: create_column('ID', table, 'id', 'id', 1),
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2), created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2), updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
state: create_column('Statut', table, 'state', 'display_state', 1) state: create_column('Statut', table, 'state', 'display_state', 1)
} }
end end
@ -73,9 +73,9 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'procedure' table = 'procedure'
{ {
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4), libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
organisation: create_column('Organisation', table, 'organisation', 'organisation', 3), organisation: create_column('Organisation', table, 'organisation', 'organisation', 3),
direction: create_column('Direction', table, 'direction', 'direction', 3) direction: create_column('Direction', table, 'direction', 'direction', 3)
} }
end end
@ -83,12 +83,12 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'entreprise' table = 'entreprise'
{ {
siren: create_column('SIREN', table, 'siren', 'siren', 2), siren: create_column('SIREN', table, 'siren', 'siren', 2),
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3), forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3), nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3), raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2), siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2), date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
} }
end end
@ -96,9 +96,9 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'etablissement' table = 'etablissement'
{ {
siret: create_column('SIRET', table, 'siret', 'siret', 2), siret: create_column('SIRET', table, 'siret', 'siret', 2),
libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3), libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3),
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1) code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
} }
end end
@ -106,19 +106,19 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
table = 'user' table = 'user'
{ {
email: create_column('Email', table, 'email', 'email', 2) email: create_column('Email', table, 'email', 'email', 2)
} }
end end
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
{ {
libelle: libelle, libelle: libelle,
table: table, table: table,
attr: attr, attr: attr,
attr_decorate: attr_decorate, attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg, bootstrap_lg: bootstrap_lg,
order: nil, order: nil,
filter: nil filter: nil
} }
end end
end end

View file

@ -5,12 +5,12 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
def self.available_columns_for procedure_id = nil def self.available_columns_for procedure_id = nil
columns = { columns = {
dossier: columns_dossier, dossier: columns_dossier,
procedure: columns_procedure, procedure: columns_procedure,
entreprise: columns_entreprise, entreprise: columns_entreprise,
etablissement: columns_etablissement, etablissement: columns_etablissement,
user: columns_user, user: columns_user,
france_connect: columns_france_connect france_connect: columns_france_connect
} }
columns columns
end end
@ -21,10 +21,10 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = nil table = nil
{ {
dossier_id: create_column('ID', table, 'id', 'id', 1), dossier_id: create_column('ID', table, 'id', 'id', 1),
created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2), created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2),
updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2), updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2),
state: create_column('Statut', table, 'state', 'display_state', 1) state: create_column('Statut', table, 'state', 'display_state', 1)
} }
end end
@ -32,9 +32,9 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'procedure' table = 'procedure'
{ {
libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4), libelle: create_column('Libellé procédure', table, 'libelle', 'libelle', 4),
organisation: create_column('Organisation', table, 'organisation', 'organisation', 3), organisation: create_column('Organisation', table, 'organisation', 'organisation', 3),
direction: create_column('Direction', table, 'direction', 'direction', 3) direction: create_column('Direction', table, 'direction', 'direction', 3)
} }
end end
@ -42,12 +42,12 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'entreprise' table = 'entreprise'
{ {
siren: create_column('SIREN', table, 'siren', 'siren', 2), siren: create_column('SIREN', table, 'siren', 'siren', 2),
forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3), forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3),
nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3), nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3),
raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3), raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3),
siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2), siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2),
date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2), date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2),
} }
end end
@ -55,16 +55,16 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'etablissement' table = 'etablissement'
{ {
siret: create_column('SIRET', table, 'siret', 'siret', 2), siret: create_column('SIRET', table, 'siret', 'siret', 2),
libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3), libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3),
code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1) code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1)
} }
end end
def self.columns_user def self.columns_user
table = 'user' table = 'user'
{ {
email: create_column('Email', table, 'email', 'email', 2) email: create_column('Email', table, 'email', 'email', 2)
} }
end end
@ -72,21 +72,21 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
table = 'france_connect_information' table = 'france_connect_information'
{ {
gender: create_column('Civilité (FC)', table, 'gender', 'gender_fr', 1), gender: create_column('Civilité (FC)', table, 'gender', 'gender_fr', 1),
given_name: create_column('Prénom (FC)', table, 'given_name', 'given_name', 2), given_name: create_column('Prénom (FC)', table, 'given_name', 'given_name', 2),
family_name: create_column('Nom (FC)', table, 'family_name', 'family_name', 2) family_name: create_column('Nom (FC)', table, 'family_name', 'family_name', 2)
} }
end end
def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg def self.create_column libelle, table, attr, attr_decorate, bootstrap_lg
{ {
libelle: libelle, libelle: libelle,
table: table, table: table,
attr: attr, attr: attr,
attr_decorate: attr_decorate, attr_decorate: attr_decorate,
bootstrap_lg: bootstrap_lg, bootstrap_lg: bootstrap_lg,
order: nil, order: nil,
filter: nil filter: nil
} }
end end
end end

View file

@ -36,14 +36,14 @@ describe Admin::PiecesJustificativesController, type: :controller do
let(:description) { "relevé d'identité bancaire" } let(:description) { "relevé d'identité bancaire" }
let(:update_params) do let(:update_params) do
{ {
types_de_piece_justificative_attributes: types_de_piece_justificative_attributes:
{
'0' =>
{ {
'0' => libelle: libelle,
{ description: description
libelle: libelle,
description: description
}
} }
}
} }
end end

View file

@ -18,17 +18,17 @@ describe Admin::ProceduresController, type: :controller do
let(:procedure_params) { let(:procedure_params) {
{ {
libelle: libelle, libelle: libelle,
description: description, description: description,
organisation: organisation, organisation: organisation,
direction: direction, direction: direction,
lien_demarche: lien_demarche, lien_demarche: lien_demarche,
cerfa_flag: cerfa_flag, cerfa_flag: cerfa_flag,
module_api_carto_attributes: { module_api_carto_attributes: {
use_api_carto: use_api_carto, use_api_carto: use_api_carto,
quartiers_prioritaires: quartiers_prioritaires, quartiers_prioritaires: quartiers_prioritaires,
cadastre: cadastre cadastre: cadastre
} }
} }
} }

View file

@ -21,18 +21,20 @@ describe Gestionnaires::PasswordsController, type: :controller do
put :update, params: {gestionnaire: { put :update, params: {gestionnaire: {
reset_password_token: @token, reset_password_token: @token,
password: "supersecret", password: "supersecret",
password_confirmation: "supersecret", password_confirmation: "supersecret"
}} }}
expect(subject.current_gestionnaire).to eq(gestionnaire) expect(subject.current_gestionnaire).to eq(gestionnaire)
expect(subject.current_user).to eq(user) expect(subject.current_user).to eq(user)
end end
it "also signs administrateur in" do it "also signs administrateur in" do
put :update, params: {gestionnaire: { put :update, params: {
reset_password_token: @token, gestionnaire: {
password: "supersecret", reset_password_token: @token,
password_confirmation: "supersecret", password: "supersecret",
}} password_confirmation: "supersecret"
}
}
expect(subject.current_administrateur).to eq(administrateur) expect(subject.current_administrateur).to eq(administrateur)
expect(subject.current_user).to eq(user) expect(subject.current_user).to eq(user)
end end

View file

@ -70,12 +70,13 @@ describe StatsController, type: :controller do
subject { @controller.send(:cumulative_hash, association, :updated_at) } subject { @controller.send(:cumulative_hash, association, :updated_at) }
it { expect(subject).to eq({ it do
expect(subject).to eq({
2.month.ago.beginning_of_month => 2, 2.month.ago.beginning_of_month => 2,
1.month.ago.beginning_of_month => 4, 1.month.ago.beginning_of_month => 4,
1.hour.ago.beginning_of_month => 5 1.hour.ago.beginning_of_month => 5
}) })
} end
end end
context "while a super admin is not logged in" do context "while a super admin is not logged in" do
@ -83,11 +84,12 @@ describe StatsController, type: :controller do
subject { @controller.send(:cumulative_hash, association, :updated_at) } subject { @controller.send(:cumulative_hash, association, :updated_at) }
it { expect(subject).to eq({ it do
expect(subject).to eq({
2.month.ago.beginning_of_month => 2, 2.month.ago.beginning_of_month => 2,
1.month.ago.beginning_of_month => 4 1.month.ago.beginning_of_month => 4
}) })
} end
end end
end end

View file

@ -18,21 +18,25 @@ describe Users::PasswordsController, type: :controller do
end end
it "also signs gestionnaire in" do it "also signs gestionnaire in" do
put :update, params: {user: { put :update, params: {
reset_password_token: @token, user: {
password: "supersecret", reset_password_token: @token,
password_confirmation: "supersecret", password: "supersecret",
}} password_confirmation: "supersecret",
}
}
expect(subject.current_user).to eq(user) expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to eq(gestionnaire) expect(subject.current_gestionnaire).to eq(gestionnaire)
end end
it "also signs administrateur in" do it "also signs administrateur in" do
put :update, params: {user: { put :update, params: {
reset_password_token: @token, user: {
password: "supersecret", reset_password_token: @token,
password_confirmation: "supersecret", password: "supersecret",
}} password_confirmation: "supersecret",
}
}
expect(subject.current_user).to eq(user) expect(subject.current_user).to eq(user)
expect(subject.current_administrateur).to eq(administrateur) expect(subject.current_administrateur).to eq(administrateur)
end end

View file

@ -7,12 +7,11 @@ describe EntrepriseDecorator do
let(:prenom) { 'mon prenom' } let(:prenom) { 'mon prenom' }
let(:entreprise_params) do let(:entreprise_params) do
{ {
capital_social: 123_000, capital_social: 123_000,
code_effectif_entreprise: code_effectif, code_effectif_entreprise: code_effectif,
raison_sociale: raison_sociale, raison_sociale: raison_sociale,
nom: nom, nom: nom,
prenom: prenom prenom: prenom
} }
end end
let(:entreprise) { create(:entreprise, entreprise_params) } let(:entreprise) { create(:entreprise, entreprise_params) }

View file

@ -24,8 +24,8 @@ describe FileSizeValidator, lib: true do
describe 'options uses a symbol' do describe 'options uses a symbol' do
let(:options) do let(:options) do
{ {
maximum: :test, maximum: :test,
attributes: { content: attachment } attributes: { content: attachment }
} }
end end

View file

@ -48,10 +48,10 @@ describe TypesDeChampService do
it do it do
is_expected.to match({ is_expected.to match({
'0' => { 'libelle' => 'a', 'order_place' => '0' }, '0' => { 'libelle' => 'a', 'order_place' => '0' },
'1' => { 'libelle' => 'c', 'order_place' => '1' }, '1' => { 'libelle' => 'c', 'order_place' => '1' },
'2' => { 'libelle' => 'b', 'order_place' => '2' } '2' => { 'libelle' => 'b', 'order_place' => '2' }
}) })
end end
end end
@ -66,10 +66,10 @@ describe TypesDeChampService do
it do it do
is_expected.to match({ is_expected.to match({
'0' => { 'libelle' => 'b', 'order_place' => '0' }, '0' => { 'libelle' => 'b', 'order_place' => '0' },
'1' => { 'libelle' => 'a', 'order_place' => '1' }, '1' => { 'libelle' => 'a', 'order_place' => '1' },
'2' => { 'libelle' => 'c', 'order_place' => '2' } '2' => { 'libelle' => 'c', 'order_place' => '2' }
}) })
end end
end end
@ -85,11 +85,11 @@ describe TypesDeChampService do
it 'does not change the natural order' do it 'does not change the natural order' do
is_expected.to match({ is_expected.to match({
'0' => { 'libelle' => 'a', 'order_place' => '0' }, '0' => { 'libelle' => 'a', 'order_place' => '0' },
'1' => { 'libelle' => 'b', 'order_place' => '1' }, '1' => { 'libelle' => 'b', 'order_place' => '1' },
'2' => { 'libelle' => 'c', 'order_place' => '2' }, '2' => { 'libelle' => 'c', 'order_place' => '2' },
'3' => { 'libelle' => 'd', 'order_place' => '3' } '3' => { 'libelle' => 'd', 'order_place' => '3' }
}) })
end end
end end
end end