test: fix for mutable string

This commit is contained in:
Colin Darie 2024-05-13 16:38:37 +02:00
parent 6d9a7648e2
commit 659d35e11f
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
6 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::DeletedDossiersComponent < ApplicationComponent class Dossiers::DeletedDossiersComponent < ApplicationComponent
include DossierHelper include DossierHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RenameSupprimesRecemmentFromProcedurePresentation < ActiveRecord::Migration[7.0] class RenameSupprimesRecemmentFromProcedurePresentation < ActiveRecord::Migration[7.0]
def up def up
ProcedurePresentation.update_all(%Q(filters = filters || '{"supprimes": []}')) ProcedurePresentation.update_all(%Q(filters = filters || '{"supprimes": []}'))

View file

@ -834,7 +834,7 @@ describe ProcedurePresentation do
let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :yes_no }]) } let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :yes_no }]) }
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({ expect(procedure_presentation.filters).to eq({
"suivis" => "suivis" =>

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
describe Siret, type: :model do describe Siret, type: :model do
subject { Siret.new(siret: siret) } subject { Siret.new(siret: siret.dup) } # .dup in order to simulate a non literal user string
context 'with no siret provided' do context 'with no siret provided' do
let(:siret) { '' } let(:siret) { '' }

View file

@ -3,7 +3,7 @@
describe FranceConnectService do describe FranceConnectService do
describe '.retrieve_user_informations_particulier' do describe '.retrieve_user_informations_particulier' do
let(:code) { 'plop' } let(:code) { 'plop' }
let(:access_token) { 'my access_token' } let(:access_token) { +'my access_token' }
let(:given_name) { 'plop1' } let(:given_name) { 'plop1' }
let(:family_name) { 'plop2' } let(:family_name) { 'plop2' }

View file

@ -112,7 +112,7 @@ describe ProcedureArchiveService do
expect(zip_entries.map(&:filename)).to match_array(structure) expect(zip_entries.map(&:filename)).to match_array(structure)
zip_entries.map do |entry| zip_entries.map do |entry|
next unless entry.filename == "#{service.send(:zip_root_folder, archive)}/-LISTE-DES-FICHIERS-EN-ERREURS.txt" next unless entry.filename == "#{service.send(:zip_root_folder, archive)}/-LISTE-DES-FICHIERS-EN-ERREURS.txt"
extracted_content = "" extracted_content = +""
extractor = entry.extractor_from(f) extractor = entry.extractor_from(f)
extracted_content << extractor.extract(1024 * 1024) until extractor.eof? extracted_content << extractor.extract(1024 * 1024) until extractor.eof?
expect(extracted_content).to match(/Impossible de .* .*cni.*png/) expect(extracted_content).to match(/Impossible de .* .*cni.*png/)