Enable the Layout/IndentationConsistency cop

This commit is contained in:
gregoirenovel 2018-01-15 19:12:15 +01:00
parent 99a49a8144
commit 1e71188d4d
8 changed files with 43 additions and 41 deletions

View file

@ -112,7 +112,7 @@ Layout/IndentHeredoc:
Enabled: true
Layout/IndentationConsistency:
Enabled: false
Enabled: true
Layout/IndentationWidth:
Enabled: true

View file

@ -47,7 +47,7 @@ class StatsController < ApplicationController
def last_four_months_hash(association, date_attribute)
min_date = 3.months.ago.beginning_of_month.to_date
association
association
.where(date_attribute => min_date..max_date)
.group("DATE_TRUNC('month', #{date_attribute.to_s})")
.count

View file

@ -1,18 +1,18 @@
module CredentialsSyncableConcern
extend ActiveSupport::Concern
included do
after_update :sync_credentials
end
included do
after_update :sync_credentials
end
def sync_credentials
if email_changed? || encrypted_password_changed?
return force_sync_credentials
end
true
def sync_credentials
if email_changed? || encrypted_password_changed?
return force_sync_credentials
end
true
end
def force_sync_credentials
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
end
def force_sync_credentials
SyncCredentialsService.new(self.class, email_was, email, encrypted_password).change_credentials!
end
end

View file

@ -26,7 +26,7 @@ class PieceJustificativeUploader < BaseUploader
if original_filename.present? || model.content_secure_token
if Features.remote_storage
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
else original_filename
else
filename = "#{model.class.to_s.underscore}.#{file.extension.downcase}"
end
end

View file

@ -1,11 +1,11 @@
class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
def change
all_mails = MailReceived.all
groupped = all_mails.group_by { |m| m.procedure_id }
filtered = groupped.reject { |k, v| v.length < 2 }
filtered.each do |k, duplicate_mails|
duplicate_mails.pop
duplicate_mails.each(&:destroy)
end
groupped = all_mails.group_by { |m| m.procedure_id }
filtered = groupped.reject { |k, v| v.length < 2 }
filtered.each do |k, duplicate_mails|
duplicate_mails.pop
duplicate_mails.each(&:destroy)
end
end
end

View file

@ -24,18 +24,17 @@ describe CARTO::SGMAP::Cadastre::Adapter do
it { expect(subject.size).to eq 9 }
it do
expect(subject.keys).to eq
[
:surface_intersection,
:surface_parcelle,
:numero,
:feuille,
:section,
:code_dep,
:nom_com,
:code_com,
:code_arr
]
expect(subject.keys).to eq [
:surface_intersection,
:surface_parcelle,
:numero,
:feuille,
:section,
:code_dep,
:nom_com,
:code_com,
:code_arr
]
end
end

View file

@ -182,19 +182,19 @@ describe TagsSubstitutionConcern, type: :model do
context "with date de dépôt" do
let(:template) { '--date de dépôt--' }
it { is_expected.to eq('03/02/2001') }
it { is_expected.to eq('03/02/2001') }
end
context "with date de passage en instruction" do
let(:template) { '--date de passage en instruction--' }
it { is_expected.to eq('06/05/2004') }
it { is_expected.to eq('06/05/2004') }
end
context "with date de décision" do
let(:template) { '--date de décision--' }
it { is_expected.to eq('09/08/2007') }
it { is_expected.to eq('09/08/2007') }
end
end

View file

@ -94,9 +94,10 @@ describe Gestionnaire, type: :model do
context 'when gestionnaire follow any dossier' do
it { is_expected.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
}
end
end
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 { 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
}
end
end
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 { 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
}
end
end
end