Change Dossier#convert_specific_array_values_to_string’s signature and name
- It is always called with the data_with_champs argument - Changing the signature requires a change of name in this case
This commit is contained in:
parent
64fdc7a2af
commit
df878b9ef4
3 changed files with 49 additions and 3 deletions
|
@ -216,9 +216,9 @@ class Dossier < ActiveRecord::Base
|
||||||
return hash
|
return hash
|
||||||
end
|
end
|
||||||
|
|
||||||
def convert_specific_array_values_to_string(array_to_convert)
|
def full_data_strings_array
|
||||||
array = []
|
array = []
|
||||||
array_to_convert.each do |value|
|
data_with_champs.each do |value|
|
||||||
value = value.to_s if !value.kind_of?(Time) && !value.nil?
|
value = value.to_s if !value.kind_of?(Time) && !value.nil?
|
||||||
array << value
|
array << value
|
||||||
end
|
end
|
||||||
|
|
|
@ -135,7 +135,7 @@ class Procedure < ActiveRecord::Base
|
||||||
|
|
||||||
headers = exportable_dossiers.any? ? exportable_dossiers.first.export_headers : []
|
headers = exportable_dossiers.any? ? exportable_dossiers.first.export_headers : []
|
||||||
data = exportable_dossiers.map do |dossier|
|
data = exportable_dossiers.map do |dossier|
|
||||||
dossier.convert_specific_array_values_to_string(dossier.data_with_champs)
|
dossier.full_data_strings_array
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -616,6 +616,52 @@ describe Dossier do
|
||||||
it { expect(subject[9]).to eq(dossier.followers_gestionnaires_emails) }
|
it { expect(subject[9]).to eq(dossier.followers_gestionnaires_emails) }
|
||||||
it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
|
it { expect(subject.count).to eq(DossierProcedureSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#full_data_string" do
|
||||||
|
let(:expected_string) {
|
||||||
|
[
|
||||||
|
dossier.id.to_s,
|
||||||
|
dossier.created_at,
|
||||||
|
dossier.updated_at,
|
||||||
|
"false",
|
||||||
|
"false",
|
||||||
|
"draft",
|
||||||
|
dossier.initiated_at,
|
||||||
|
dossier.received_at,
|
||||||
|
dossier.processed_at,
|
||||||
|
gestionnaire.email,
|
||||||
|
nil,
|
||||||
|
"44011762001530",
|
||||||
|
"true",
|
||||||
|
"4950Z",
|
||||||
|
"Transports par conduites",
|
||||||
|
"GRTGAZ IMMEUBLE BORA 6 RUE RAOUL NORDLING 92270 BOIS COLOMBES",
|
||||||
|
"6",
|
||||||
|
"RUE",
|
||||||
|
"RAOUL NORDLING",
|
||||||
|
"IMMEUBLE BORA",
|
||||||
|
"92270",
|
||||||
|
"BOIS COLOMBES",
|
||||||
|
"92009",
|
||||||
|
"440117620",
|
||||||
|
"537100000",
|
||||||
|
"FR27440117620",
|
||||||
|
"SA à conseil d'administration (s.a.i.)",
|
||||||
|
"5599",
|
||||||
|
"GRTGAZ",
|
||||||
|
"GRTGAZ",
|
||||||
|
"44011762001530",
|
||||||
|
"51",
|
||||||
|
dossier.entreprise.date_creation,
|
||||||
|
nil,
|
||||||
|
nil
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
subject { dossier }
|
||||||
|
|
||||||
|
it { expect(dossier.full_data_strings_array).to eq(expected_string)}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#Dossier.to_csv' do
|
describe '#Dossier.to_csv' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue