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 Enabled: false
Rails/AfterCommitOverride: Rails/AfterCommitOverride:
Enabled: true Enabled: true
Rails/AttributeDefaultBlockValue:
Enabled: true
Rails/FindById: Rails/FindById:
Enabled: true Enabled: true
Rails/Inquiry: Rails/Inquiry:
@ -1342,6 +1344,8 @@ Rails/ShortI18n:
Enabled: true Enabled: true
Rails/SquishedSQLHeredocs: Rails/SquishedSQLHeredocs:
Enabled: true Enabled: true
Rails/WhereEquals:
Enabled: true
Rails/WhereExists: Rails/WhereExists:
Enabled: true Enabled: true
Rails/WhereNot: Rails/WhereNot:

View file

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

View file

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

View file

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