Use string interpolation

This commit is contained in:
gregoirenovel 2018-01-15 21:41:16 +01:00
parent 83be054884
commit 80ed589a17
10 changed files with 14 additions and 14 deletions

View file

@ -2,7 +2,7 @@ class EntrepriseDecorator < Draper::Decorator
delegate_all delegate_all
def raison_sociale_or_name def raison_sociale_or_name
raison_sociale.blank? ? nom + ' ' + prenom : raison_sociale raison_sociale.blank? ? "#{nom} #{prenom}" : raison_sociale
end end
def effectif def effectif

View file

@ -9,7 +9,7 @@ class FindDubiousProceduresJob < ApplicationJob
def perform(*args) def perform(*args)
# \\y is a word boundary # \\y is a word boundary
forbidden_regexp = FORBIDDEN_KEYWORDS forbidden_regexp = FORBIDDEN_KEYWORDS
.map { |keyword| '\\y' + keyword + '\\y' } .map { |keyword| "\\y#{keyword}\\y" }
.join('|') .join('|')
# ~* -> case insensitive regexp match # ~* -> case insensitive regexp match

View file

@ -52,7 +52,7 @@ class Champ < ActiveRecord::Base
end end
def self.departements def self.departements
JSON.parse(Carto::GeoAPI::Driver.departements).map { |liste| liste['code'] + ' - ' + liste['nom'] }.push('99 - Étranger') JSON.parse(Carto::GeoAPI::Driver.departements).map { |liste| "#{liste['code']} - #{liste['nom']}" }.push('99 - Étranger')
end end
def self.pays def self.pays

View file

@ -8,7 +8,7 @@ class PiecesJustificativesService
.partition { |_, content| ClamavService.safe_file?(content.path) } .partition { |_, content| ClamavService.safe_file?(content.path) }
errors = with_virus errors = with_virus
.map { |_, content| content.original_filename + ' : virus détecté' } .map { |_, content| "#{content.original_filename} : virus détecté" }
errors += without_virus errors += without_virus
.map { |tpj, content| save_pj(content, dossier, tpj, user) } .map { |tpj, content| save_pj(content, dossier, tpj, user) }
@ -26,7 +26,7 @@ class PiecesJustificativesService
pj.save pj.save
else else
pj = PieceJustificative.new pj = PieceJustificative.new
pj.errors.add(:content, content.original_filename + ': <b>Virus détecté !!</b>') pj.errors.add(:content, "#{content.original_filename} : <b>Virus détecté !!</b>")
end end
pj pj

View file

@ -17,7 +17,7 @@ class RenderPartialService
def self.left_panel_exist? left_panel_url def self.left_panel_exist? left_panel_url
file = left_panel_url.split('/').last file = left_panel_url.split('/').last
File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', '_' + file + '.html.haml')) File.exist?(Rails.root.join('app','views', 'layouts', 'left_panels', "_#{file}.html.haml"))
end end
private private
@ -31,6 +31,6 @@ class RenderPartialService
end end
def retrieve_name def retrieve_name
controller.to_s.parameterize.underscore + '_' + method.to_s "#{controller.to_s.parameterize.underscore}_#{method.to_s}"
end end
end end

View file

@ -8,8 +8,8 @@ require 'yaml'
# ansible config # ansible config
class Features class Features
class << self class << self
if File.exist?(File.dirname(__FILE__) + '/features.yml') if File.exist?("#{File.dirname(__FILE__)}/features.yml")
features_map = YAML.load_file(File.dirname(__FILE__) + '/features.yml') features_map = YAML.load_file("#{File.dirname(__FILE__)}/features.yml")
if features_map if features_map
features_map.each do |feature, is_active| features_map.each do |feature, is_active|
define_method("#{feature}") do define_method("#{feature}") do

View file

@ -1 +1 @@
STORAGE_URL = "https://storage.apientreprise.fr/" + CarrierWave::Uploader::Base.fog_directory + '/' STORAGE_URL = "https://storage.apientreprise.fr/#{CarrierWave::Uploader::Base.fog_directory}/"

View file

@ -279,7 +279,7 @@ shared_examples 'description_controller_spec' do
it { expect(response).to redirect_to users_dossier_recapitulatif_path } it { expect(response).to redirect_to users_dossier_recapitulatif_path }
context 'when champs is type_de_champ datetime' do context 'when champs is type_de_champ datetime' do
it { expect(dossier.champs.find(dossier_datetime_champ_id).value).to eq(dossier_date_value + ' ' + dossier_hour_value + ':' + dossier_minute_value) } it { expect(dossier.champs.find(dossier_datetime_champ_id).value).to eq("#{dossier_date_value} #{dossier_hour_value}:#{dossier_minute_value}") }
end end
context 'when champs value is empty' do context 'when champs value is empty' do

View file

@ -27,7 +27,7 @@ describe EntrepriseDecorator do
context 'when raison_sociale is nil' do context 'when raison_sociale is nil' do
let(:raison_sociale) { nil } let(:raison_sociale) { nil }
it 'display nom and prenom' do it 'display nom and prenom' do
expect(subject).to eq(nom + ' ' + prenom) expect(subject).to eq("#{nom} #{prenom}")
end end
end end
end end

View file

@ -8,12 +8,12 @@ describe RenderPartialService do
describe 'navbar' do describe 'navbar' do
subject { service.navbar } subject { service.navbar }
it { is_expected.to eq 'layouts/navbars/navbar_' + controller.to_s.parameterize + '_' + method.to_s } it { is_expected.to eq "layouts/navbars/navbar_#{controller.to_s.parameterize}_#{method.to_s}" }
end end
describe 'left_panel' do describe 'left_panel' do
subject { service.left_panel } subject { service.left_panel }
it { is_expected.to eq 'layouts/left_panels/left_panel_' + controller.to_s.parameterize + '_' + method.to_s } it { is_expected.to eq "layouts/left_panels/left_panel_#{controller.to_s.parameterize}_#{method.to_s}" }
end end
end end