Fix new Rubocop warnings

This commit is contained in:
Pierre de La Morinerie 2021-02-16 15:05:04 +01:00 committed by Pierre de La Morinerie (Rebase PR Action)
parent f41c1f9ff4
commit 98be7e2076
4 changed files with 16 additions and 9 deletions

View file

@ -1320,6 +1320,8 @@ Rails/ActiveRecordCallbacksOrder:
Enabled: false
Rails/AfterCommitOverride:
Enabled: true
Rails/AttributeDefaultBlockValue:
Enabled: true
Rails/FindById:
Enabled: true
Rails/Inquiry:
@ -1342,6 +1344,8 @@ Rails/ShortI18n:
Enabled: true
Rails/SquishedSQLHeredocs:
Enabled: true
Rails/WhereEquals:
Enabled: true
Rails/WhereExists:
Enabled: true
Rails/WhereNot:

View file

@ -62,7 +62,7 @@ class DossierSearchService
def self.to_tsquery(search_terms)
(search_terms || "")
.gsub(/['?\\:&|!<>\(\)]/, "") # drop disallowed characters
.gsub(/['?\\:&|!<>()]/, "") # drop disallowed characters
.strip
.split(/\s+/) # split words
.map { |x| "#{x}:*" } # enable prefix matching

View file

@ -914,9 +914,11 @@ describe ProcedurePresentation do
it 'should downcase and transform value' do
procedure_presentation.add_filter("suivis", "type_de_champ/#{first_type_de_champ_id}", "Oui")
expect(procedure_presentation.filters).to eq({ "suivis" => [
{ "label" => first_type_de_champ.libelle, "table" => "type_de_champ", "column" => first_type_de_champ_id, "value" => "true" }
]
expect(procedure_presentation.filters).to eq({
"suivis" =>
[
{ "label" => first_type_de_champ.libelle, "table" => "type_de_champ", "column" => first_type_de_champ_id, "value" => "true" }
]
})
end
end
@ -927,9 +929,10 @@ describe ProcedurePresentation do
it 'should passthrough value' do
procedure_presentation.add_filter("suivis", "type_de_champ/#{first_type_de_champ_id}", "Oui")
expect(procedure_presentation.filters).to eq({ "suivis" => [
{ "label" => first_type_de_champ.libelle, "table" => "type_de_champ", "column" => first_type_de_champ_id, "value" => "Oui" }
]
expect(procedure_presentation.filters).to eq({
"suivis" => [
{ "label" => first_type_de_champ.libelle, "table" => "type_de_champ", "column" => first_type_de_champ_id, "value" => "Oui" }
]
})
end
end

View file

@ -27,8 +27,8 @@ module FeatureHelpers
if sign_in_by_link
mail = ActionMailer::Base.deliveries.last
message = mail.html_part.body.raw_source
instructeur_id = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 1]
jeton = message[/\".+\/connexion-par-jeton\/(.+)\?jeton=(.*)\"/, 2]
instructeur_id = message[/".+\/connexion-par-jeton\/(.+)\?jeton=(.*)"/, 1]
jeton = message[/".+\/connexion-par-jeton\/(.+)\?jeton=(.*)"/, 2]
visit sign_in_by_link_path(instructeur_id, jeton: jeton)
end