Enable the Layout/IndentationConsistency cop
This commit is contained in:
parent
99a49a8144
commit
1e71188d4d
8 changed files with 43 additions and 41 deletions
|
@ -112,7 +112,7 @@ Layout/IndentHeredoc:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Layout/IndentationConsistency:
|
Layout/IndentationConsistency:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/IndentationWidth:
|
Layout/IndentationWidth:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
@ -47,7 +47,7 @@ class StatsController < ApplicationController
|
||||||
def last_four_months_hash(association, date_attribute)
|
def last_four_months_hash(association, date_attribute)
|
||||||
min_date = 3.months.ago.beginning_of_month.to_date
|
min_date = 3.months.ago.beginning_of_month.to_date
|
||||||
|
|
||||||
association
|
association
|
||||||
.where(date_attribute => min_date..max_date)
|
.where(date_attribute => min_date..max_date)
|
||||||
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
|
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
|
||||||
.count
|
.count
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
module CredentialsSyncableConcern
|
module CredentialsSyncableConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
after_update :sync_credentials
|
after_update :sync_credentials
|
||||||
end
|
end
|
||||||
|
|
||||||
def sync_credentials
|
def sync_credentials
|
||||||
if email_changed? || encrypted_password_changed?
|
if email_changed? || encrypted_password_changed?
|
||||||
return force_sync_credentials
|
return force_sync_credentials
|
||||||
end
|
|
||||||
true
|
|
||||||
end
|
end
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def force_sync_credentials
|
def force_sync_credentials
|
||||||
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
|
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,7 @@ class PieceJustificativeUploader < BaseUploader
|
||||||
if original_filename.present? || model.content_secure_token
|
if original_filename.present? || model.content_secure_token
|
||||||
if Features.remote_storage
|
if Features.remote_storage
|
||||||
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
|
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
|
||||||
else original_filename
|
else
|
||||||
filename = "#{model.class.to_s.underscore}.#{file.extension.downcase}"
|
filename = "#{model.class.to_s.underscore}.#{file.extension.downcase}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
|
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
all_mails = MailReceived.all
|
all_mails = MailReceived.all
|
||||||
groupped = all_mails.group_by { |m| m.procedure_id }
|
groupped = all_mails.group_by { |m| m.procedure_id }
|
||||||
filtered = groupped.reject { |k, v| v.length < 2 }
|
filtered = groupped.reject { |k, v| v.length < 2 }
|
||||||
filtered.each do |k, duplicate_mails|
|
filtered.each do |k, duplicate_mails|
|
||||||
duplicate_mails.pop
|
duplicate_mails.pop
|
||||||
duplicate_mails.each(&:destroy)
|
duplicate_mails.each(&:destroy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,18 +24,17 @@ describe CARTO::SGMAP::Cadastre::Adapter do
|
||||||
|
|
||||||
it { expect(subject.size).to eq 9 }
|
it { expect(subject.size).to eq 9 }
|
||||||
it do
|
it do
|
||||||
expect(subject.keys).to eq
|
expect(subject.keys).to eq [
|
||||||
[
|
:surface_intersection,
|
||||||
:surface_intersection,
|
:surface_parcelle,
|
||||||
:surface_parcelle,
|
:numero,
|
||||||
:numero,
|
:feuille,
|
||||||
:feuille,
|
:section,
|
||||||
:section,
|
:code_dep,
|
||||||
:code_dep,
|
:nom_com,
|
||||||
:nom_com,
|
:code_com,
|
||||||
:code_com,
|
:code_arr
|
||||||
:code_arr
|
]
|
||||||
]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -182,19 +182,19 @@ describe TagsSubstitutionConcern, type: :model do
|
||||||
context "with date de dépôt" do
|
context "with date de dépôt" do
|
||||||
let(:template) { '--date de dépôt--' }
|
let(:template) { '--date de dépôt--' }
|
||||||
|
|
||||||
it { is_expected.to eq('03/02/2001') }
|
it { is_expected.to eq('03/02/2001') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with date de passage en instruction" do
|
context "with date de passage en instruction" do
|
||||||
let(:template) { '--date de passage en instruction--' }
|
let(:template) { '--date de passage en instruction--' }
|
||||||
|
|
||||||
it { is_expected.to eq('06/05/2004') }
|
it { is_expected.to eq('06/05/2004') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with date de décision" do
|
context "with date de décision" do
|
||||||
let(:template) { '--date de décision--' }
|
let(:template) { '--date de décision--' }
|
||||||
|
|
||||||
it { is_expected.to eq('09/08/2007') }
|
it { is_expected.to eq('09/08/2007') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,10 @@ describe Gestionnaire, type: :model do
|
||||||
context 'when gestionnaire follow any dossier' do
|
context 'when gestionnaire follow any dossier' 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 do
|
||||||
|
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject)
|
||||||
subject
|
subject
|
||||||
}
|
end
|
||||||
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
|
||||||
|
@ -106,9 +107,10 @@ 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 do
|
||||||
|
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).not_to receive(:inject)
|
||||||
subject
|
subject
|
||||||
}
|
end
|
||||||
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
|
||||||
|
@ -121,9 +123,10 @@ 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 do
|
||||||
|
expect_any_instance_of(Dossier::ActiveRecord_AssociationRelation).to receive(:inject)
|
||||||
subject
|
subject
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue