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
def raison_sociale_or_name
raison_sociale.blank? ? nom + ' ' + prenom : raison_sociale
raison_sociale.blank? ? "#{nom} #{prenom}" : raison_sociale
end
def effectif

View file

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

View file

@ -52,7 +52,7 @@ class Champ < ActiveRecord::Base
end
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
def self.pays

View file

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

View file

@ -17,7 +17,7 @@ class RenderPartialService
def self.left_panel_exist? left_panel_url
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
private
@ -31,6 +31,6 @@ class RenderPartialService
end
def retrieve_name
controller.to_s.parameterize.underscore + '_' + method.to_s
"#{controller.to_s.parameterize.underscore}_#{method.to_s}"
end
end

View file

@ -8,8 +8,8 @@ require 'yaml'
# ansible config
class Features
class << self
if File.exist?(File.dirname(__FILE__) + '/features.yml')
features_map = YAML.load_file(File.dirname(__FILE__) + '/features.yml')
if File.exist?("#{File.dirname(__FILE__)}/features.yml")
features_map = YAML.load_file("#{File.dirname(__FILE__)}/features.yml")
if features_map
features_map.each do |feature, is_active|
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 }
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
context 'when champs value is empty' do

View file

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

View file

@ -8,12 +8,12 @@ describe RenderPartialService do
describe 'navbar' do
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
describe 'left_panel' do
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