From 9669fee7fec71b4bd516ec6e7df83925c0b2588f Mon Sep 17 00:00:00 2001 From: Xavier J Date: Mon, 11 Jul 2016 14:43:20 +0200 Subject: [PATCH] Add state attribut in API --- app/serializers/dossier_serializer.rb | 3 ++- spec/controllers/api/v1/dossiers_controller_spec.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/serializers/dossier_serializer.rb b/app/serializers/dossier_serializer.rb index 90b391f66..0a79f1242 100644 --- a/app/serializers/dossier_serializer.rb +++ b/app/serializers/dossier_serializer.rb @@ -4,7 +4,8 @@ class DossierSerializer < ActiveModel::Serializer :created_at, :updated_at, :archived, - :mandataire_social + :mandataire_social, + :state has_one :entreprise has_one :etablissement diff --git a/spec/controllers/api/v1/dossiers_controller_spec.rb b/spec/controllers/api/v1/dossiers_controller_spec.rb index 83518f772..3e0554444 100644 --- a/spec/controllers/api/v1/dossiers_controller_spec.rb +++ b/spec/controllers/api/v1/dossiers_controller_spec.rb @@ -116,7 +116,7 @@ describe API::V1::DossiersController do let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, procedure: procedure) } } let(:dossier_id) { dossier.id } let(:body) { JSON.parse(retour.body, symbolize_names: true) } - let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires] } + let(:field_list) { [:id, :nom_projet, :created_at, :updated_at, :archived, :mandataire_social, :entreprise, :etablissement, :cerfa, :types_de_piece_justificative, :pieces_justificatives, :champs, :commentaires, :state] } subject { body[:dossier] } it 'return REST code 200', :show_in_doc do @@ -124,6 +124,7 @@ describe API::V1::DossiersController do end it { expect(subject[:id]).to eq(dossier.id) } it { expect(subject[:nom_projet]).to eq(dossier.nom_projet) } + it { expect(subject[:state]).to eq(dossier.state) } it { expect(subject[:created_at]).to eq('2008-09-01T08:05:00.000Z') } it { expect(subject[:updated_at]).to eq('2008-09-01T08:05:00.000Z') } it { expect(subject[:archived]).to eq(dossier.archived) }