commit
458d671c14
5 changed files with 14 additions and 9 deletions
|
@ -9,6 +9,7 @@ class DossierSerializer < ActiveModel::Serializer
|
|||
:initiated_at,
|
||||
:received_at,
|
||||
:processed_at,
|
||||
:motivation,
|
||||
:accompagnateurs,
|
||||
:invites
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ class DossierTableExportSerializer < ActiveModel::Serializer
|
|||
:state,
|
||||
:initiated_at,
|
||||
:received_at,
|
||||
:processed_at
|
||||
:processed_at,
|
||||
:motivation
|
||||
|
||||
attribute :emails_accompagnateurs
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
"initiated_at": "2017-04-11T12:00:12.000Z",
|
||||
"received_at": null,
|
||||
"processed_at": null,
|
||||
"motivation": null,
|
||||
"accompagnateurs": [
|
||||
"gestionnaire@apientreprise.fr"
|
||||
],
|
||||
|
|
|
@ -111,10 +111,10 @@ describe API::V1::DossiersController do
|
|||
context 'when dossier exists and belongs to procedure' do
|
||||
let(:procedure_id) { procedure.id }
|
||||
let(:date_creation) { Time.utc(2008, 9, 1, 10, 5, 0) }
|
||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } }
|
||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure, motivation: "Motivation") } }
|
||||
let(:dossier_id) { dossier.id }
|
||||
let(:body) { JSON.parse(retour.body, symbolize_names: true) }
|
||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :accompagnateurs, :invites] }
|
||||
let(:field_list) { [:id, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :champs_private, :commentaires, :state, :simplified_state, :initiated_at, :processed_at, :received_at, :motivation, :accompagnateurs, :invites] }
|
||||
subject { body[:dossier] }
|
||||
|
||||
it 'return REST code 200', :show_in_doc do
|
||||
|
|
|
@ -492,7 +492,7 @@ describe Dossier do
|
|||
let(:date1) { 1.day.ago }
|
||||
let(:date2) { 1.hour.ago }
|
||||
let(:date3) { 1.minute.ago }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow], initiated_at: date1, received_at: date2, processed_at: date3) }
|
||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure, follows: [follow], initiated_at: date1, received_at: date2, processed_at: date3, motivation: "Motivation") }
|
||||
|
||||
describe '#export_headers' do
|
||||
subject { dossier.export_headers }
|
||||
|
@ -518,10 +518,11 @@ describe Dossier do
|
|||
it { expect(subject[7]).to eq(date2) }
|
||||
it { expect(subject[8]).to eq(date3) }
|
||||
it { expect(subject[9]).to be_a_kind_of(String) }
|
||||
it { expect(subject[10]).to be_nil }
|
||||
it { expect(subject[10]).to be_a_kind_of(String) }
|
||||
it { expect(subject[11]).to be_nil }
|
||||
it { expect(subject[12]).to be_nil }
|
||||
it { expect(subject[13]).to be_nil }
|
||||
it { expect(subject[14]).to be_nil }
|
||||
it { expect(subject.count).to eq(DossierTableExportSerializer.new(dossier).attributes.count + dossier.procedure.types_de_champ.count + dossier.export_entreprise_data.count) }
|
||||
|
||||
context 'dossier for individual' do
|
||||
|
@ -529,10 +530,10 @@ describe Dossier do
|
|||
|
||||
subject { dossier_with_individual.data_with_champs }
|
||||
|
||||
it { expect(subject[10]).to eq(dossier_with_individual.individual.gender) }
|
||||
it { expect(subject[11]).to eq(dossier_with_individual.individual.prenom) }
|
||||
it { expect(subject[12]).to eq(dossier_with_individual.individual.nom) }
|
||||
it { expect(subject[13]).to eq(dossier_with_individual.individual.birthdate) }
|
||||
it { expect(subject[11]).to eq(dossier_with_individual.individual.gender) }
|
||||
it { expect(subject[12]).to eq(dossier_with_individual.individual.prenom) }
|
||||
it { expect(subject[13]).to eq(dossier_with_individual.individual.nom) }
|
||||
it { expect(subject[14]).to eq(dossier_with_individual.individual.birthdate) }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -548,6 +549,7 @@ describe Dossier do
|
|||
dossier.initiated_at,
|
||||
dossier.received_at,
|
||||
dossier.processed_at,
|
||||
"Motivation",
|
||||
gestionnaire.email,
|
||||
nil,
|
||||
nil,
|
||||
|
|
Loading…
Reference in a new issue