#to_sorted_values -> #sorted_values

This commit is contained in:
gregoirenovel 2018-04-26 18:42:06 +02:00
parent 886431b120
commit 8848abc536
2 changed files with 5 additions and 5 deletions

View file

@ -142,7 +142,7 @@ class Dossier < ApplicationRecord
end
def export_values
to_sorted_values.map do |value|
sorted_values.map do |value|
serialize_value_for_export(value)
end
end
@ -307,7 +307,7 @@ class Dossier < ApplicationRecord
convert_specific_hash_values_to_string(etablissement_attr.merge(entreprise_attr))
end
def to_sorted_values
def sorted_values
serialized_dossier = DossierTableExportSerializer.new(self)
values = serialized_dossier.attributes.values
values += ordered_champs.map(&:for_export)

View file

@ -232,8 +232,8 @@ describe Dossier do
end
end
describe '#to_sorted_values' do
subject { dossier.send(:to_sorted_values) }
describe '#sorted_values' do
subject { dossier.send(:sorted_values) }
it { expect(subject[0]).to be_a_kind_of(Integer) }
it { expect(subject[1]).to be_a_kind_of(Time) }
@ -261,7 +261,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.send(:to_sorted_values) }
subject { dossier_with_individual.send(:sorted_values) }
it { expect(subject[11]).to eq(dossier_with_individual.individual.gender) }
it { expect(subject[12]).to eq(dossier_with_individual.individual.prenom) }