Dossier: rename data_with_champs to to_sorted_values

This commit is contained in:
Simon Lehericey 2017-10-26 16:37:10 +02:00
parent f0373f6bc2
commit 3f2419a2a3
2 changed files with 10 additions and 10 deletions

View file

@ -232,7 +232,7 @@ class Dossier < ActiveRecord::Base
end
def full_data_strings_array
data_with_champs.map do |value|
to_sorted_values.map do |value|
serialize_value_for_export(value)
end
end
@ -248,13 +248,13 @@ class Dossier < ActiveRecord::Base
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
end
def data_with_champs
def to_sorted_values
serialized_dossier = DossierTableExportSerializer.new(self)
data = serialized_dossier.attributes.values
data += self.ordered_champs.map(&:value)
data += self.ordered_champs_private.map(&:value)
data += self.export_entreprise_data.values
data
values = serialized_dossier.attributes.values
values += self.ordered_champs.map(&:value)
values += self.ordered_champs_private.map(&:value)
values += self.export_entreprise_data.values
values
end
def export_headers

View file

@ -412,8 +412,8 @@ describe Dossier do
}
end
describe '#data_with_champs' do
subject { dossier.data_with_champs }
describe '#to_sorted_values' do
subject { dossier.to_sorted_values }
it { expect(subject[0]).to be_a_kind_of(Integer) }
it { expect(subject[1]).to be_a_kind_of(Time) }
@ -441,7 +441,7 @@ describe Dossier do
context 'dossier for individual' do
let(:dossier_with_individual) { create(:dossier, :for_individual, user: user, procedure: procedure) }
subject { dossier_with_individual.data_with_champs }
subject { dossier_with_individual.to_sorted_values }
it { expect(subject[12]).to eq(dossier_with_individual.individual.gender) }
it { expect(subject[13]).to eq(dossier_with_individual.individual.prenom) }